/* ============================================================
   NetSentinel Visual — Design System
   Tema: Pontos + Cards Sólidos Escuros
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── Custom Properties ─── */
:root {
  --color-bg:          #080d1a;
  --color-surface:     #111828;
  --color-surface-2:   #0f1829;
  --color-border:      #1e2d44;
  --color-border-2:    #1e3050;
  --color-border-h:    rgba(99,179,255,0.18);

  --color-up:          #4dd9a0;
  --color-up-bg:       #0a2218;
  --color-down:        #f07070;
  --color-down-bg:     rgba(240,112,112,0.1);
  --color-warning:     #f59e0b;

  --color-accent:      #63b3ff;
  --color-accent-2:    #6366f1;

  --color-text:        #d0e4ff;
  --color-text-muted:  #607090;
  --color-text-dim:    #b8d0f0;

  --radius-sm:  6px;
  --radius-md:  9px;
  --radius-lg:  10px;
  --radius-xl:  14px;

  --shadow-card: 0 0 0 1px rgba(99,179,255,0.06), inset 0 1px 0 rgba(99,179,255,0.07);
  --shadow-metric: inset 0 1px 0 rgba(99,179,255,0.08);

  --transition: 0.22s cubic-bezier(.4,0,.2,1);
  --transition-slow: 0.45s cubic-bezier(.4,0,.2,1);
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--color-bg);
  background-image: radial-gradient(rgba(99,179,255,.18) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 11px 11px;
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ─── Gradient overlays ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 50% 35%, rgba(37,99,235,.28) 0%, transparent 70%),
    radial-gradient(ellipse 35% 30% at 8% 12%, rgba(99,102,241,.20) 0%, transparent 65%),
    radial-gradient(ellipse 30% 28% at 90% 88%, rgba(14,165,233,.16) 0%, transparent 65%),
    radial-gradient(ellipse 100% 100% at 50% 50%, transparent 40%, rgba(8,13,26,.95) 100%);
}

/* ─── Layout ─── */
.app-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ─── Header ─── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,13,26,0.8);
  border-bottom: 0.5px solid rgba(99,179,255,0.1);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-container h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--color-text);
}

.badge {
  display: inline-block;
  background: var(--color-surface);
  color: var(--color-accent);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 4px;
  border: 0.5px solid var(--color-border);
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Pulse Indicator ─── */
.pulse-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.pulse-indicator::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  animation: pulse-ring 2s ease-out infinite;
}

.status-up { background: #4dd9a0; }
.status-up::after { border: 2px solid #4dd9a0; }

.status-down { background: #f07070; }
.status-down::after { border: 2px solid #f07070; }

.status-warning { background: var(--color-warning); }
.status-warning::after { border: 2px solid var(--color-warning); }

@keyframes pulse-ring {
  0%   { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0;   transform: scale(2.2); }
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 0.5px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  outline: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn.primary {
  background: var(--color-surface);
  color: var(--color-text-dim);
  border-color: var(--color-border);
}
.btn.primary:hover {
  transform: translateY(-1px);
  border-color: var(--color-border-h);
  color: var(--color-text);
}
.btn.primary:active { transform: translateY(0); }

.btn.ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.btn.ghost:hover {
  background: rgba(99,179,255,0.05);
  color: var(--color-text);
  border-color: var(--color-border-h);
}

.btn.danger {
  background: var(--color-down-bg);
  color: var(--color-down);
  border-color: rgba(240,112,112,0.30);
}
.btn.danger:hover {
  background: rgba(240,112,112,0.18);
}

.btn.icon-only {
  padding: 8px;
  border-radius: var(--radius-sm);
}

.hidden { display: none !important; }

/* ─── Main Content ─── */
main {
  padding: 1.5rem 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* ─── Navigation Tabs ─── */
.nav-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
  border-bottom: 0.5px solid var(--color-border);
  padding-bottom: 1rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--color-text-muted);
  border: 0.5px solid transparent;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.nav-btn:hover {
  color: var(--color-text);
  background: rgba(99,179,255,0.04);
}

.nav-btn.active {
  color: var(--color-text);
  background: var(--color-surface);
  border-color: var(--color-border);
  box-shadow: inset 0 2px 0 var(--color-accent);
}

.nav-icon {
  font-size: 1.1rem;
}

/* ─── Stats Bar ─── */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.75rem;
  border-radius: var(--radius-md);
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  box-shadow: var(--shadow-metric);
}

.stats-left {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.stat-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

.text-success { color: #4dd9a0 !important; }
.text-danger  { color: #f07070 !important; }
.text-warning { color: var(--color-warning) !important; }

/* ─── Section Header ─── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-title {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
}

/* ─── Devices Grid ─── */
.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* ─── Device Card ─── */
.device-card {
  background: var(--color-surface-2);
  border: 0.5px solid var(--color-border-2);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.device-card:hover {
  border-color: var(--color-border-h);
  transform: translateY(-2px);
}

.device-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  transition: background var(--transition);
}

.device-card.card-up::before   { background: linear-gradient(90deg, #4dd9a0, transparent); }
.device-card.card-down::before { background: linear-gradient(90deg, #f07070, transparent); }
.device-card.card-warning::before { background: linear-gradient(90deg, var(--color-warning), transparent); }

.device-card.card-down {
  border-color: rgba(240,112,112,0.20);
  animation: card-alert-pulse 3s ease-in-out 0.5s infinite;
}

@keyframes card-alert-pulse {
  0%, 100% { box-shadow: var(--shadow-card); }
  50%       { box-shadow: var(--shadow-card), 0 0 0 4px rgba(240,112,112,0.12); }
}

/* Muted card — suppress alert pulse */
.device-card.card-muted.card-down {
  animation: none;
  border-color: var(--color-border-2);
  opacity: 0.7;
}

.muted-indicator {
  font-size: 0.75rem;
  margin-left: 4px;
  opacity: 0.7;
}

.btn-mute.muted {
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.btn-edit:hover {
  color: var(--color-accent) !important;
  border-color: rgba(99,179,255,0.25);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
  min-width: 0;
}

.card-info {
  min-width: 0;
  flex: 1;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.card-address {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.status-container {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.response-time {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(99, 179, 255, 0.08);
  border: 0.5px solid rgba(99, 179, 255, 0.2);
  color: #63b3ff;
  transition: all var(--transition);
}

.card-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
}

.badge-up {
  background: #0a2218;
  color: #4dd9a0;
  border: 0.5px solid rgba(77,217,160,0.35);
}

.badge-down {
  background: rgba(240,112,112,0.1);
  color: #f07070;
  border: 0.5px solid rgba(240,112,112,0.30);
}

.badge-warning {
  background: rgba(245,158,11,0.1);
  color: var(--color-warning);
  border: 0.5px solid rgba(245,158,11,0.30);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 0.5px solid var(--color-border);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(99,179,255,0.06);
  color: var(--color-text-muted);
}

.card-failures {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.card-failures span {
  color: var(--color-down);
  font-weight: 700;
}

.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* ─── Icon-only action buttons ─── */
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  padding: 0;
}

.btn-action:hover {
  background: rgba(99,179,255,0.06);
  color: var(--color-text);
  border-color: var(--color-border-h);
}

.btn-action.btn-edit:hover {
  color: var(--color-accent);
  border-color: rgba(99,179,255,0.25);
}

.btn-action.btn-delete:hover {
  color: #f07070;
  border-color: rgba(240,112,112,0.30);
  background: rgba(240,112,112,0.06);
}

.btn-action.btn-mute {
  color: #f07070;
  border-color: rgba(240,112,112,0.25);
  background: rgba(240,112,112,0.06);
}

.btn-action.btn-mute:hover {
  background: rgba(240,112,112,0.14);
  border-color: rgba(240,112,112,0.35);
}

.btn-action.btn-mute.muted {
  color: var(--color-text-muted);
  border-color: var(--color-border);
  background: transparent;
}

.btn-action.btn-mute.muted:hover {
  color: #4dd9a0;
  border-color: rgba(77,217,160,0.25);
  background: rgba(77,217,160,0.06);
}

.muted-indicator {
  font-size: 0.75rem;
  margin-left: 4px;
  opacity: 0.7;
}

/* ─── Loading / Empty State ─── */
.loading-state, .empty-state {
  grid-column: 1/-1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: var(--color-text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.empty-icon { font-size: 2.5rem; opacity: 0.4; }
.empty-text { font-size: 0.9rem; text-align: center; }
.empty-hint { font-size: 0.78rem; color: var(--color-text-muted); opacity: 0.7; }

/* ─── Event Log Section ─── */
.events-panel {
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--color-border);
  background: var(--color-surface-2);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.events-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 0.5px solid var(--color-border);
}

.events-title {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
}

.events-list {
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

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

.event-row {
  display: grid;
  grid-template-columns: 140px 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 0.5px solid var(--color-border);
  font-size: 0.8rem;
  animation: row-in 0.3s ease both;
  transition: background var(--transition);
}

.event-row:hover { background: rgba(99,179,255,0.03); }

@keyframes row-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}

.event-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.event-device { font-weight: 600; color: var(--color-text); }

.event-transition {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.arrow-icon { color: #63b3ff; }
.status-tag-up      { color: #4dd9a0; }
.status-tag-down    { color: #f07070; }
.status-tag-warning { color: var(--color-warning); }

.events-empty {
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,13,26,0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), inset 0 1px 0 rgba(99,179,255,0.08);
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal { transform: none; }

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--color-text);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1rem;
}

label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
}

input, select {
  background: rgba(99,179,255,0.04);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

input::placeholder { color: var(--color-text-muted); }

input:focus, select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(99,179,255,0.15);
}

select option {
  background: var(--color-surface);
  color: var(--color-text);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 1.5rem;
}

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

/* ─── Toast Notifications ─── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(99,179,255,0.07);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: toast-in 0.3s ease both;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.removing {
  opacity: 0;
  transform: translateX(20px);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: none; }
}

.toast-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.toast.success .toast-dot { background: #4dd9a0; }
.toast.error   .toast-dot { background: #f07070; }
.toast.info    .toast-dot { background: var(--color-accent); }
.toast.warning .toast-dot { background: var(--color-warning); }

/* ─── WebSocket Status ─── */
.ws-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
}

.ws-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-text-muted);
  transition: background var(--transition);
}

.ws-dot.connected { background: #4dd9a0; box-shadow: 0 0 6px rgba(77,217,160,0.4); }
.ws-dot.connecting { background: var(--color-warning); animation: blink 1s step-end infinite; }
.ws-dot.disconnected { background: #f07070; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ─── Delete confirm animation ─── */
.device-card.removing {
  animation: card-out 0.3s ease forwards;
}
@keyframes card-out {
  to { opacity: 0; transform: scale(0.95); }
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  header { padding: 0 1rem; }
  main   { padding: 1rem 1rem 2rem; }
  .stats-bar { padding: 0.875rem 1rem; }
  .stat-value { font-size: 1.4rem; }
  .devices-grid { grid-template-columns: 1fr; }
  .event-row { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
}

@media (max-width: 480px) {
  .logo-container h1 { font-size: 1rem; }
  .controls .btn span { display: none; }
}

/* ─── Scrollbar global ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-h); }

/* ─── Details Modal — Wide Variant ─── */
.modal-details-wide {
  max-width: 620px;
  padding: 1.75rem;
}

.details-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.details-header-left { flex: 1; min-width: 0; }

.details-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-icon-close {
  padding: 6px;
  border-radius: var(--radius-sm);
  line-height: 0;
}

/* ─── Details Stats Row ─── */
.details-stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.details-stat-box {
  flex: 1 1 110px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0.9rem 1rem;
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-metric);
}

/* ─── Section Labels ─── */
.details-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.65rem;
}

.details-section-sub {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-text-muted);
  opacity: 0.75;
}

/* ─── L7 Chart ─── */
.l7-chart {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.l7-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.l7-bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 52px;
  align-items: center;
  gap: 0.75rem;
  animation: row-in 0.3s ease both;
}

.l7-bar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.l7-bar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.9;
}

.l7-bar-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.l7-bar-track {
  height: 8px;
  background: rgba(99,179,255,0.07);
  border-radius: 999px;
  overflow: hidden;
  border: 0.5px solid var(--color-border);
}

.l7-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.85;
}

.l7-bar-value {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ─── Sparkline ─── */
.l7-sparkline-container {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.spark-meta {
  display: flex;
  gap: 1.25rem;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-bottom: 0.6rem;
}

.spark-meta strong { font-weight: 700; }

.spark-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 56px;
  padding-bottom: 2px;
}

.spark-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-width: 4px;
  opacity: 0.8;
  transition: opacity var(--transition);
  cursor: default;
}

.spark-bar:hover { opacity: 1; }

.spark-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: var(--color-text-muted);
  opacity: 0.65;
  margin-top: 4px;
}

/* ─── Responsive tweaks for wide modal ─── */
@media (max-width: 680px) {
  .modal-details-wide { max-width: 100%; }
  .l7-bar-row { grid-template-columns: 110px 1fr 44px; }
}

.spinning {
  animation: spin 0.8s linear infinite !important;
}


/* ─── Toggle Switch (Keyword Matching) ─── */
.switch-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: 8px;
  flex-shrink: 0;
}

.switch-label input[type=checkbox] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  background: var(--color-surface-2);
  border: 0.5px solid var(--color-border);
  border-radius: 999px;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-text-muted);
  transition: transform var(--transition), background var(--transition);
}

.switch-label input:checked + .switch-track {
  background: rgba(77, 217, 160, 0.18);
  border-color: rgba(77, 217, 160, 0.45);
}

.switch-label input:checked + .switch-track .switch-thumb {
  transform: translateX(18px);
  background: #4dd9a0;
}

.switch-label:hover .switch-track {
  border-color: var(--color-border-h);
}


/* ─── DB Monitor Cards ──────────────────────────────── */

.status-critical-lock {
  background: rgba(255, 59, 92, 0.15);
  color: #ff3b5c;
  border: 1px solid rgba(255, 59, 92, 0.4);
  animation: pulse-critical 1.4s ease-in-out infinite;
}

@keyframes pulse-critical {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 92, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(255, 59, 92, 0); }
}

.status-warning {
  background: rgba(255, 186, 8, 0.12);
  color: #ffba08;
  border: 1px solid rgba(255, 186, 8, 0.35);
}

.card-critical-lock {
  border-color: rgba(255, 59, 92, 0.4) !important;
  box-shadow: 0 0 0 1px rgba(255, 59, 92, 0.2), var(--shadow-card) !important;
}

.lock-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 59, 92, 0.18);
  color: #ff3b5c;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  margin-left: 6px;
  letter-spacing: 0.02em;
}

.no-locks {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  opacity: 0.7;
}

.form-hint {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  opacity: 0.75;
}

/* ============================================================
   Network Discovery Panel
   ============================================================ */
.discovery-panel {
  background: #0f1829;
  border: 0.5px solid #1e3050;
  border-radius: var(--radius-md);
  padding: 1.25rem 1.25rem 1.1rem;
  margin-bottom: 1.5rem;
}

.discovery-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.discovery-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #d0e4ff;
  letter-spacing: 0.02em;
}
.discovery-hint {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: #607090;
  max-width: 70ch;
  line-height: 1.4;
}

.discovery-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.discovery-controls input {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition);
}
.discovery-controls input:focus {
  border-color: var(--color-accent);
}
.discovery-controls .btn { white-space: nowrap; }

.discovery-progress {
  margin-top: 1rem;
}
.progress-bar {
  height: 6px;
  background: rgba(99,179,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #63b3ff, #4dd9a0);
  border-radius: 999px;
  transition: width 0.18s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.72rem;
  color: #607090;
  font-family: 'JetBrains Mono', monospace;
}
.progress-meta #progress-found {
  color: #4dd9a0;
  font-weight: 600;
}

.discovery-results {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}
.discovery-empty {
  margin-top: 1rem;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: #607090;
  border: 1px dashed #1e3050;
  border-radius: var(--radius-md);
}

.discovery-card {
  background: rgba(15, 24, 41, 0.6);
  border: 0.5px solid #1e3050;
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  animation: discoveryFadeIn 0.3s ease;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.discovery-card.added {
  border-color: #4dd9a0;
  background: rgba(77,217,160,0.06);
}
.discovery-card.adding {
  opacity: 0.7;
}
@keyframes discoveryFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.discovery-card-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #63b3ff;
}

.discovery-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.discovery-card-row-1 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.discovery-ip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: #d0e4ff;
}
.discovery-vendor {
  font-size: 0.75rem;
  color: #b8d0f0;
}
.discovery-mac {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: #607090;
}
.discovery-card-row-2 {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.device-type-badge {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}
.device-type-switch       { background: rgba(99,179,255,0.10);  color: #63b3ff; }
.device-type-router       { background: rgba(77,217,160,0.10);  color: #4dd9a0; }
.device-type-firewall     { background: rgba(240,112,112,0.10); color: #f07070; }
.device-type-access_point { background: rgba(167,139,250,0.10); color: #a78bfa; }
.device-type-unknown      { background: rgba(96,112,144,0.10);  color: #607090; }

.port-tag, .mgmt-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.66rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99,179,255,0.06);
  color: #b8d0f0;
  border: 1px solid rgba(99,179,255,0.10);
}
.mgmt-tag {
  background: rgba(77,217,160,0.06);
  color: #4dd9a0;
  border-color: rgba(77,217,160,0.15);
  font-weight: 600;
}

.discovery-add-btn {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(99,179,255,0.10);
  color: #63b3ff;
  border: 1px solid rgba(99,179,255,0.25);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.discovery-add-btn:hover:not(:disabled) {
  background: rgba(99,179,255,0.18);
}
.discovery-add-btn:disabled {
  cursor: default;
  opacity: 0.6;
}
.discovery-add-btn.added {
  background: rgba(77,217,160,0.10);
  color: #4dd9a0;
  border-color: rgba(77,217,160,0.25);
}

.discovery-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(99,179,255,0.08);
}

/* ============================================================
   Maintenance Windows
   ============================================================ */
.modal-maintenance-wide { max-width: 720px; width: 92%; }

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--color-text-dim);
  cursor: pointer;
}
.switch-row input[type="checkbox"] { accent-color: #63b3ff; }

.mw-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid rgba(99,179,255,0.04);
  font-size: 0.78rem;
}
.mw-row:last-child { border-bottom: none; }
.mw-row.inactive { opacity: 0.55; }
.mw-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #607090;
}
.mw-status-dot.active {
  background: #4dd9a0;
  box-shadow: 0 0 0 3px rgba(77,217,160,0.18);
}
.mw-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mw-meta-line-1 {
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mw-meta-line-2 {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.mw-target-badge {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(99,179,255,0.08);
  color: #63b3ff;
  white-space: nowrap;
}
.mw-target-badge.global {
  background: rgba(167,139,250,0.10);
  color: #a78bfa;
}
/* ─── Detalhes: validação de conteúdo (texto monitorado) ─── */
/* Banner coeso: ícone (lupa) + rótulo + valor. O valor pode quebrar em
   várias linhas quando longo, em vez de truncar com reticências. */
.details-keyword {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.8rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.04));
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: var(--radius-md);
}
/* Ícone de lupa — sinaliza que o texto é "procurado" no conteúdo da página */
.details-keyword .dk-icon {
  flex-shrink: 0;
  display: flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-sm);
}
.details-keyword .dk-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.details-keyword .dk-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.details-keyword .dk-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 500;
  color: #a5b4fc;
  word-break: break-word;
  line-height: 1.35;
}

.mw-actions { display: flex; gap: 4px; }
.mw-action-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.7rem;
  transition: color var(--transition), border-color var(--transition);
}
.mw-action-btn:hover { color: var(--color-accent); border-color: rgba(99,179,255,0.25); }
.mw-action-btn.danger:hover { color: var(--color-down); border-color: rgba(240,112,112,0.25); }

/* Maintenance badge on device cards */
.card-maintenance-badge {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(245,158,11,0.10);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.25);
  white-space: nowrap;
}
.device-card.in-maintenance {
  outline: 1px dashed rgba(245,158,11,0.35);
  outline-offset: -1px;
}
