/* DR Network & DR Wi-Fi Analyzer — Enterprise Dark Theme */
:root {
  --bg-base: #070b14;
  --bg-surface: #0d1420;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --bg-sidebar: #0a0f1c;
  --bg-topbar: rgba(10,15,28,0.95);
  --border: rgba(255,255,255,0.08);
  --border-accent: rgba(0,180,255,0.3);

  --accent-blue: #00b4ff;
  --accent-cyan: #00e5ff;
  --accent-green: #00e676;
  --accent-yellow: #ffca28;
  --accent-orange: #ff9800;
  --accent-red: #ff5252;
  --accent-purple: #ce93d8;

  --text-primary: #e8eaed;
  --text-secondary: #8b9ab5;
  --text-muted: #4a5568;

  --sidebar-width: 220px;
  --topbar-height: 60px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(0,180,255,0.15);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Courier New', 'Fira Code', monospace;

  --transition: 0.2s ease;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  overflow: hidden;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-blue);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 8px 0;
  flex: 1;
}

.nav-group {
  margin-bottom: 4px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 10px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  border-radius: 0;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  user-select: none;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(0,180,255,0.08);
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
  font-weight: 500;
}

.nav-item .nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* ============================================================
   MAIN AREA
   ============================================================ */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  backdrop-filter: blur(10px);
  z-index: 50;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-blue);
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

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

.status-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 500;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.status-dot.warning { background: var(--accent-yellow); }
.status-dot.error { background: var(--accent-red); }
.status-dot.inactive { background: var(--text-muted); }

.topbar-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-select {
  background: #0d1420;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.topbar-select option {
  background: #0d1420;
  color: #e8eaed;
}

.topbar-select:focus {
  border-color: var(--accent-blue);
}

.topbar-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  width: 160px;
}

.topbar-input::placeholder { color: var(--text-muted); }
.topbar-input:focus { border-color: var(--accent-blue); }

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
}

.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============================================================
   PAGES
   ============================================================ */
.page { display: none; }
.page.active { display: block; }

.page-header {
  margin-bottom: 20px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* ============================================================
   GRID
   ============================================================ */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  backdrop-filter: blur(8px);
  transition: border-color var(--transition);
}

.card:hover { border-color: var(--border-accent); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.card-icon {
  font-size: 16px;
  opacity: 0.7;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.card-unit {
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: 4px;
}

.card-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ============================================================
   SCORE CARD
   ============================================================ */
.score-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  gap: 24px;
  align-items: center;
  backdrop-filter: blur(8px);
}

.score-circle-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.score-circle-svg {
  transform: rotate(-90deg);
}

.score-track {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 8;
}

.score-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.score-text-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.score-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.score-details {
  flex: 1;
}

.score-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.score-detail-item {
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.score-detail-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.score-detail-value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}

.score-classification {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   CHARTS
   ============================================================ */
.chart-container {
  position: relative;
  height: 160px;
}

.chart-container.tall { height: 220px; }
.chart-container.medium { height: 180px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table thead th {
  background: rgba(255,255,255,0.04);
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td {
  background: rgba(255,255,255,0.02);
  color: var(--text-primary);
}

.data-table td .mono { font-family: var(--font-mono); font-size: 11px; }

/* ============================================================
   RSSI BADGE
   ============================================================ */
.rssi-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.rssi-excellent { background: rgba(0,230,118,0.15); color: var(--accent-green); }
.rssi-good { background: rgba(0,180,255,0.15); color: var(--accent-blue); }
.rssi-fair { background: rgba(255,202,40,0.15); color: var(--accent-yellow); }
.rssi-poor { background: rgba(255,82,82,0.15); color: var(--accent-red); }

/* ============================================================
   SECURITY BADGE
   ============================================================ */
.sec-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.sec-wpa3 { background: rgba(0,230,118,0.15); color: var(--accent-green); }
.sec-wpa2 { background: rgba(0,180,255,0.15); color: var(--accent-blue); }
.sec-wpa { background: rgba(255,202,40,0.15); color: var(--accent-yellow); }
.sec-open { background: rgba(255,82,82,0.15); color: var(--accent-red); }
.sec-wep { background: rgba(255,152,0,0.15); color: var(--accent-orange); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: var(--font);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-blue);
  color: #000;
}
.btn-primary:hover { background: #00ccff; }

.btn-success {
  background: var(--accent-green);
  color: #000;
}
.btn-success:hover { background: #00ff88; }

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}
.btn-danger:hover { background: #ff7070; }

.btn-warning {
  background: var(--accent-yellow);
  color: #000;
}
.btn-warning:hover { background: #ffe066; }

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-accent); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 5px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  font-family: var(--font);
  transition: border-color var(--transition);
}

.form-control::placeholder { color: var(--text-muted); }
.form-control:focus { border-color: var(--accent-blue); }

select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-surface); }

textarea.form-control { resize: vertical; min-height: 80px; }

/* ============================================================
   ALERTS / NOTIFICATIONS
   ============================================================ */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid;
  font-size: 12px;
}

.alert-item.critical {
  background: rgba(255,82,82,0.08);
  border-color: rgba(255,82,82,0.3);
  color: #ff8a8a;
}

.alert-item.warning {
  background: rgba(255,202,40,0.08);
  border-color: rgba(255,202,40,0.3);
  color: #ffe280;
}

.alert-item.info {
  background: rgba(0,180,255,0.08);
  border-color: rgba(0,180,255,0.3);
  color: #80d8ff;
}

.alert-item.success {
  background: rgba(0,230,118,0.08);
  border-color: rgba(0,230,118,0.3);
  color: #80ffb0;
}

.alert-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }

.alert-title {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 2px;
}

.alert-msg { color: inherit; opacity: 0.85; }

/* ============================================================
   CHANNEL BARS
   ============================================================ */
.channel-bar-wrap {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 80px;
  padding: 8px 0 0;
}

.channel-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  transition: height 0.5s ease;
  position: relative;
  cursor: pointer;
  min-width: 12px;
}

.channel-bar.good { background: rgba(0,230,118,0.6); }
.channel-bar.warning { background: rgba(255,202,40,0.6); }
.channel-bar.critical { background: rgba(255,82,82,0.6); }

.channel-bar:hover { filter: brightness(1.3); }

.channel-bar-label {
  font-size: 8px;
  text-align: center;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
}

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline {
  list-style: none;
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 12px;
  font-size: 12px;
}

.timeline-dot {
  position: absolute;
  left: -17px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--bg-base);
}

.timeline-dot.critical { background: var(--accent-red); }
.timeline-dot.warning { background: var(--accent-yellow); }
.timeline-dot.info { background: var(--accent-blue); }
.timeline-dot.success { background: var(--accent-green); }

.timeline-time { color: var(--text-muted); font-size: 10px; }
.timeline-title { font-weight: 500; color: var(--text-primary); }
.timeline-detail { color: var(--text-secondary); font-size: 11px; }

/* ============================================================
   WAR ROOM
   ============================================================ */
#page-warroom.active {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.warroom-header {
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.warroom-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-blue);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.warroom-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 20px;
  padding: 20px 40px;
}

.warroom-metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  transition: border-color 0.5s ease;
}

.warroom-metric.critical { border-color: rgba(255,82,82,0.5); }
.warroom-metric.warning { border-color: rgba(255,202,40,0.5); }
.warroom-metric.good { border-color: rgba(0,230,118,0.3); }

.warroom-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.warroom-value {
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.warroom-unit {
  font-size: 18px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.warroom-ssid-row {
  padding: 10px 40px;
  text-align: center;
  font-size: 16px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 11px;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform var(--transition);
}

.toggle input:checked + .toggle-slider { background: var(--accent-blue); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-fill.blue { background: var(--accent-blue); }
.progress-fill.green { background: var(--accent-green); }
.progress-fill.yellow { background: var(--accent-yellow); }
.progress-fill.red { background: var(--accent-red); }

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-blue { color: var(--accent-blue); }
.text-green { color: var(--accent-green); }
.text-yellow { color: var(--accent-yellow); }
.text-red { color: var(--accent-red); }
.text-orange { color: var(--accent-orange); }

.mono { font-family: var(--font-mono); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.w-full { width: 100%; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-blue { background: rgba(0,180,255,0.15); color: var(--accent-blue); }
.badge-green { background: rgba(0,230,118,0.15); color: var(--accent-green); }
.badge-yellow { background: rgba(255,202,40,0.15); color: var(--accent-yellow); }
.badge-red { background: rgba(255,82,82,0.15); color: var(--accent-red); }
.badge-gray { background: rgba(255,255,255,0.08); color: var(--text-secondary); }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ============================================================
   RECOMMENDATION CARDS
   ============================================================ */
.rec-card {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.rec-icon { font-size: 20px; flex-shrink: 0; }

.rec-title { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.rec-msg { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.rec-action { font-size: 11px; color: var(--accent-blue); }

/* ============================================================
   SCAN SEARCH
   ============================================================ */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent-blue); }

/* ============================================================
   IPERF RESULTS
   ============================================================ */
.iperf-result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.iperf-metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.iperf-metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.iperf-metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.iperf-metric-unit {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   PULSE ANIMATION
   ============================================================ */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse { animation: pulse 2s infinite; }

/* ============================================================
   LAN DOCTOR — Phase dots
   ============================================================ */
.ld-phase-dot {
  flex: 1;
  text-align: center;
  font-size: 14px;
  padding: 4px;
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  opacity: 0.35;
  transition: all 0.3s ease;
}
.ld-phase-dot.active {
  opacity: 1;
  background: rgba(0,180,255,0.1);
  border-color: var(--accent-blue);
  animation: pulse 1.5s infinite;
}
.ld-phase-dot.done {
  opacity: 1;
  background: rgba(0,230,118,0.08);
  border-color: rgba(0,230,118,0.4);
  animation: none;
}

/* ============================================================
   HAMBURGER / MENU TOGGLE (visible only on mobile)
   ============================================================ */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  line-height: 1;
  transition: background var(--transition);
}
.menu-toggle:hover { background: var(--bg-card-hover); }

/* ============================================================
   SIDEBAR BACKDROP (mobile overlay)
   ============================================================ */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 150;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.open { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .warroom-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(4, 1fr); }
  .warroom-value { font-size: 48px; }
}

@media (max-width: 768px) {
  .sidebar { width: 180px; }
  --sidebar-width: 180px;
  .grid-3, .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .score-card { flex-direction: column; }
  .iperf-result-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  /* ---- Sidebar: overlay deslizante ---- */
  .menu-toggle { display: flex; align-items: center; }

  .sidebar {
    display: flex !important;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }

  /* ---- Topbar compacta ---- */
  .topbar {
    padding: 0 10px;
    gap: 8px;
    height: 52px;
  }
  .topbar-title {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
  }
  .topbar-divider { display: none; }
  .status-badges { display: none; }
  .topbar-controls { display: none; }

  /* ---- Conteúdo compacto ---- */
  .content-area { padding: 10px; }

  /* ---- Grids para coluna única ---- */
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5 { grid-template-columns: 1fr !important; }

  /* Grids com style inline (ex: "360px 1fr") também colapsam */
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* ---- Score card ---- */
  .score-card { flex-direction: column; align-items: center; }
  .score-details-grid { grid-template-columns: 1fr 1fr; }

  /* ---- War room ---- */
  .warroom-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    padding: 10px;
    gap: 10px;
  }
  .warroom-value { font-size: 36px; }
  .warroom-header { padding: 12px 16px; }

  /* ---- Tabelas: scroll horizontal ---- */
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* ---- Toast menor ---- */
  #toast-container { bottom: 10px; right: 10px; }
  .toast { max-width: calc(100vw - 20px); font-size: 12px; }

  /* ---- Botões touch-friendly ---- */
  .btn { min-height: 40px; }
  .nav-item { padding: 10px 16px; min-height: 44px; }
}

/* ============================================================
   SCROLLABLE TABLE CELLS
   ============================================================ */
.ssid-cell {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   QUALITY BAR
   ============================================================ */
.quality-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quality-fill {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.quality-fill-inner {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.quality-num {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}

/* ============================================================
   INFO ROW (key: value)
   ============================================================ */
.info-rows { }

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 13px;
}

.info-row:last-child { border-bottom: none; }

.info-row-label { color: var(--text-secondary); }
.info-row-value { color: var(--text-primary); font-weight: 500; }

/* ============================================================
   NOTIFICATION TOAST
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  animation: slideIn 0.3s ease;
  max-width: 300px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success { border-color: rgba(0,230,118,0.4); }
.toast.error { border-color: rgba(255,82,82,0.4); }
.toast.warning { border-color: rgba(255,202,40,0.4); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== Paridade visual com o app original — iPerf3 e Diagnóstico LAN/WAN ===== */
/* metricCard() — usado no resultado do iPerf3 */
.metric-card{background:var(--bg-card);border:1px solid var(--border);border-radius:8px;padding:12px;text-align:center}
.metric-label{font-size:11px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px;margin-bottom:6px}
.metric-value{font-size:24px;font-weight:700}
.metric-unit{font-size:11px;color:var(--text-muted);margin-top:2px}

/* ndCard() — usado nos cards do Diagnóstico LAN/WAN */
.nd-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px;margin-bottom:20px}
.nd-card{background:var(--bg-card);border:1px solid var(--border);border-radius:10px;padding:14px 16px;border-left:3px solid var(--text-muted)}
.nd-card.nd-ok{border-left-color:var(--accent-green)}
.nd-card.nd-warn{border-left-color:var(--accent-yellow)}
.nd-card.nd-err{border-left-color:var(--accent-red)}
.nd-card-label{font-size:11px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px;margin-bottom:6px}
.nd-card-value{font-size:22px;font-weight:700;margin-bottom:4px}
.nd-card-sub{font-size:11px;color:var(--text-secondary);line-height:1.4}

/* barra de score do diagnóstico (no original eram estilos inline) */
.nd-score-bar{background:var(--bg-card);border:1px solid var(--border);border-radius:10px;padding:14px 18px;margin-bottom:12px;display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.nd-medium-badge{font-size:12px;font-weight:600;padding:3px 10px;border-radius:12px;background:rgba(0,180,255,.12);color:var(--accent-blue)}
.nd-score-track{flex:1;min-width:120px;height:8px;background:rgba(255,255,255,.08);border-radius:4px;overflow:hidden}
.nd-score-fill{height:100%;width:0;border-radius:4px;transition:width .6s}
.nd-score-val{font-size:22px;font-weight:700;min-width:54px;text-align:right}
.nd-score-label{font-size:12px;color:var(--text-secondary);min-width:70px}
.nd-reasons{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:16px}
.nd-reason-chip{font-size:11px;padding:4px 10px;border-radius:14px;background:var(--bg-card);border:1px solid var(--border);color:var(--text-secondary)}
.nd-reason-chip.good{border-color:var(--accent-green);color:var(--accent-green)}
.nd-reason-chip.bad{border-color:var(--accent-red);color:var(--accent-red)}
.nd-reason-chip.warn{border-color:var(--accent-yellow);color:var(--accent-yellow)}
.badge-gray{background:rgba(139,154,181,0.15);color:var(--text-muted)}
