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

/* ─── CSS Variables (sidebar + dashboard) ─── */
:root {
  --sidebar-width: 260px;
  --sidebar-bg: linear-gradient(180deg, #ffffff 0%, #f0f4ff 100%);
  --sidebar-border: #dde4f0;
  --sidebar-link-hover: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
  --sidebar-link-active: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --glass-border: #e2e8f0;
  --primary-color: #60a5fa;
  --online-color: #34d399;
  --degraded-color: #fbbf24;
  --offline-color: #f87171;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --bg-deep: #F0F2F5;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8F9FA;
  --border: rgba(0,0,0,0.08);
  --border-light: rgba(0,0,0,0.05);
  --text: #1F2937;
  --text-dim: #6B7280;
  --text-muted: #9CA3AF;
  --green: #16A34A;
  --green-bg: rgba(22,163,74,0.10);
  --yellow: #CA8A04;
  --yellow-bg: rgba(202,138,4,0.10);
  --red: #DC2626;
  --red-bg: rgba(220,38,38,0.10);
  --blue: #2563EB;
  --blue-bg: rgba(37,99,235,0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.10);
  --font: 'Outfit', -apple-system, sans-serif;
}
[data-theme="dark"] {
  --sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  --sidebar-border: rgba(255, 255, 255, 0.05);
  --sidebar-link-hover: rgba(255, 255, 255, 0.05);
  --sidebar-link-active: rgba(99, 102, 241, 0.15);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --glass-border: rgba(255, 255, 255, 0.08);
  --bg-deep: #0B1220;
  --bg-card: #1F2937;
  --bg-card-hover: #263249;
  --border: rgba(255,255,255,0.06);
  --text: #F1F5F9;
  --text-dim: #94A3B8;
  --text-muted: #64748B;
}

/* ─── Layout ─── */
body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  overflow-x: hidden;
  display: flex;
  min-height: 100vh;
}
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  position: fixed;
  height: 100vh;
  box-shadow: 2px 0 20px rgba(99, 102, 241, 0.06);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.2); border-radius: 10px; }
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 3rem;
  cursor: pointer;
}
.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 10px;
  display: flex;
  align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff;
}
.nav-links { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-link-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--sidebar-link-active);
  color: #6366f1;
  font-weight: 600;
}
.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--glass-border);
  margin-top: auto;
}
.avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 10px;
  display: flex;
  align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-profile .info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.user-profile .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-profile .role {
  font-size: 11px;
  color: var(--text-secondary);
}
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 110;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ─── NOC Dashboard styles ─── */
  --bg-deep: #F0F2F5;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8F9FA;
  --border: rgba(0,0,0,0.08);
  --border-light: rgba(0,0,0,0.05);
  --text: #1F2937;
  --text-dim: #6B7280;
  --text-muted: #9CA3AF;
  --green: #16A34A;
  --green-bg: rgba(22,163,74,0.10);
  --yellow: #CA8A04;
  --yellow-bg: rgba(202,138,4,0.10);
  --red: #DC2626;
  --red-bg: rgba(220,38,38,0.10);
  --blue: #2563EB;
  --blue-bg: rgba(37,99,235,0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.10);
  --font: 'Outfit', -apple-system, sans-serif;
  --transition: 0.2s ease;
}

/* ─── Page-specific overrides (scoped to .noc-dashboard) ─── */
.noc-dashboard {
  padding: 20px 24px 60px;
  background: var(--bg-deep);
}
.noc-dashboard::-webkit-scrollbar { width: 6px; }
.noc-dashboard::-webkit-scrollbar-track { background: transparent; }
.noc-dashboard::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo-isp {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--blue);
}
.logo-isp i { font-size: 24px; }
.logo-text .light { font-weight: 300; color: var(--text); }
.header-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  padding-left: 16px;
}

.header-center { display: flex; gap: 12px; align-items: center; }
.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}
.filter-group i { color: var(--text-muted); font-size: 13px; }
.filter-group select {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
  min-width: 140px;
}
.filter-group select option { background: var(--bg-card); color: var(--text); }

.header-right { display: flex; align-items: center; gap: 12px; }
.btn-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition);
}
.btn-refresh:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-refresh:disabled { opacity: 0.5; cursor: default; }
.btn-refresh:disabled:hover { background: var(--bg-deep); color: var(--text-dim); border-color: var(--border); }
.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.status-badge.stable { background: var(--green-bg); color: var(--green); }
.status-badge.alert  { background: var(--yellow-bg); color: var(--yellow); }
.status-badge.incident { background: var(--red-bg); color: var(--red); }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-badge.stable .status-dot { background: var(--green); }
.status-badge.alert .status-dot  { background: var(--yellow); }
.status-badge.incident .status-dot { background: var(--red); }
.header-clock {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 80px;
  text-align: right;
}

.section { margin-bottom: 20px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-header h2 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-header h2 i { color: var(--blue); }
.section-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.health-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.health-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}
.health-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
}
.health-card.status-healthy::before  { background: var(--green); }
.health-card.status-alert::before   { background: var(--yellow); }
.health-card.status-critical::before { background: var(--red); }

.health-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.health-card-name {
  font-size: 15px;
  font-weight: 700;
}
.health-card-led {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.health-card-led.led-green  { background: var(--green); }
.health-card-led.led-yellow { background: var(--yellow); }
.health-card-led.led-red    { background: var(--red); }

.health-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.health-stat {
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
}
.health-stat-value {
  font-size: 20px;
  font-weight: 800;
}
.health-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 2px;
}
.health-stat-value.green  { color: var(--green); }
.health-stat-value.yellow { color: var(--yellow); }
.health-stat-value.red    { color: var(--red); }

.health-card-extra {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.health-card-extra span { display: flex; align-items: center; gap: 4px; }
.health-card-extra i { font-size: 11px; }

.charts-row {
  display: flex;
  gap: 14px;
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-half  { flex: 1; min-width: 0; }
.card-kpis  { flex: 0.38; min-width: 260px; }
.card-events { flex: 0.62; min-width: 380px; }
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.chart-header h3 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-header h3 i { color: var(--blue); }
.chart-container { width: 100%; min-height: 240px; }

.kpi-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kpi-card {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.kpi-card-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.kpi-card-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}
.kpi-card-value .highlight { color: var(--red); font-weight: 800; }
.kpi-card-value .dim { color: var(--text-dim); font-size: 13px; font-weight: 400; }

.events-table-wrap { overflow-x: auto; }
.events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.events-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.events-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.events-table tbody tr:hover td { background: var(--bg-card-hover); }
.events-table .sev-critical { color: var(--red); font-weight: 600; }
.events-table .sev-warning  { color: #CA8A04; font-weight: 600; }
.events-table .sev-info     { color: var(--blue); font-weight: 600; }

.events-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 4px;
}
.events-pagination button {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
}
.events-pagination button:hover:not(:disabled) {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.events-pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}
.events-pagination .page-info {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 8px;
}
.events-pagination .page-info strong { color: var(--text); }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-dim);
  gap: 12px;
}
.loading-overlay i { font-size: 24px; }

/* ─── PON Port Grid (misma que Dashboard 1) ─── */
.ports-box {
  flex: 2;
  min-width: 160px;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.olt-ports-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.olt-ports-stats {
  display: flex;
  gap: 10px;
  font-size: 0.65rem;
  font-weight: 700;
}
.port-stat {
  cursor: pointer;
  transition: opacity 0.2s;
}
.port-stat:hover {
  opacity: 0.7;
}
.port-stat.up {
  color: #10b981;
}
.port-stat.down {
  color: #ef4444;
}
.port-bars-container {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.port-bar {
  width: 8px;
  height: 16px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
}
.port-bar:hover {
  transform: scaleY(1.2);
  filter: brightness(1.1);
}

@media (max-width: 1024px) {
  .noc-dashboard { padding: 14px; }
  .charts-row { flex-direction: column; }
  .card-kpis, .card-events { flex: 1; min-width: 0; }
  .top-header { flex-wrap: wrap; gap: 10px; }
  .header-center { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
  .filter-group { flex: 1; }
  .filter-group select { min-width: 0; width: 100%; }
  .header-title { display: none; }
  .health-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .content { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.active { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .mobile-menu-btn { display: flex; }
  #closeMobileMenu { display: block !important; }
  .noc-dashboard { padding: 12px 10px 40px; margin-top: 56px; }
  .top-header { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 14px; }
  .header-left { justify-content: space-between; }
  .header-center { order: unset; width: 100%; flex-direction: row; }
  .header-center .filter-group { flex: 1; min-width: 0; }
  .filter-group select { min-width: 0; width: 100%; font-size: 12px; }
  .header-right { justify-content: space-between; }
  .header-clock { font-size: 15px; min-width: auto; }
  .status-badge { font-size: 10px; padding: 3px 10px; }
  .logo-isp { font-size: 17px; }
  .logo-isp i { font-size: 20px; }
  .health-grid { grid-template-columns: 1fr; }
  .health-card { padding: 14px; }
  .health-card-name { font-size: 14px; }
  .health-card-stats { gap: 5px; }
  .health-stat-value { font-size: 17px; }
  .health-card-extra { flex-wrap: wrap; gap: 6px; font-size: 11px; }
  .health-card-extra span { flex: 1; min-width: 45%; }
  .section-header h2 { font-size: 14px; }
  .section-subtitle { font-size: 11px; }
  .chart-card { padding: 12px; }
  .chart-card h3 { font-size: 13px; }
  .chart-container { min-height: 200px; }
  .kpi-card { padding: 12px 14px; }
  .kpi-card-value { font-size: 14px; }
  .events-table { font-size: 11px; }
  .events-table th,
  .events-table td { padding: 8px 10px; }
  .events-table td { white-space: normal; word-break: break-word; }
  .card-events { min-width: 0; }
  .events-pagination { flex-wrap: wrap; }
  .events-pagination button { font-size: 11px; padding: 5px 10px; }
  .port-bar { width: 7px; height: 14px; }
  .olt-ports-stats { font-size: 0.6rem; gap: 6px; }
  #global-footer > div { padding: 12px 14px !important; }
  #global-footer > div > div:last-child { gap: 4px 10px !important; font-size: 11px !important; }
  .section { margin-bottom: 14px; }
  .health-grid { gap: 10px; }
  .charts-row { gap: 10px; }
}
@media (max-width: 480px) {
  .noc-dashboard { padding: 8px 6px 30px; }
  .top-header { padding: 8px 10px; }
  .header-left .logo-text { font-size: 15px; }
  .header-clock { font-size: 13px; }
  .header-center { flex-direction: column; }
  .filter-group { width: 100%; }
  .health-card { padding: 12px; }
  .health-stat-value { font-size: 15px; }
  .chart-card { padding: 10px; }
  .chart-container { min-height: 180px; }
  .events-table { font-size: 10px; }
  .events-table th,
  .events-table td { padding: 6px 8px; }
  .events-pagination .page-info { font-size: 10px; }
  .port-bar { width: 6px; height: 12px; gap: 2px; }
  .port-bars-container { gap: 2px; }
  #global-footer > div { padding: 10px 10px !important; }
  #global-footer > div > div:last-child { flex-direction: column !important; gap: 3px !important; font-size: 10px !important; }
  #global-footer > div > div:last-child span { display: none; }
}
