:root {
  --topbar-bg: #1c3dcb;
  --topbar-hover: #2950e3;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --text-main: #1e293b;
  --text-sub: #64748b;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

body {
  margin: 0; font-family: 'Inter', sans-serif;
  background-color: var(--bg-main); color: var(--text-main);
}

/* TOPBAR */
.topbar {
  background: var(--topbar-bg); color: white;
  display: flex; align-items: center; padding: 0 1.5rem; height: 60px;
}
.topbar .logo {
  font-weight: 600; font-size: 1.25rem; margin-right: 3rem; letter-spacing: -0.5px;
}
.top-nav { display: flex; gap: 0.5rem; height: 100%; }
.top-nav a {
  color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.85rem;
  padding: 0 1rem; display: flex; align-items: center; border-radius: 6px;
  margin: 10px 0; transition: 0.2s; font-weight: 500;
}
.top-nav a:hover { background: rgba(255,255,255,0.1); color:white; }
.top-nav a.active { background: var(--topbar-hover); color: white; }

/* LAYOUT */
.layout {
  display: flex; padding: 2rem; gap: 2rem; max-width: 1400px; margin: 0 auto;
}

/* SIDEBAR */
.sidebar { width: 260px; flex-shrink: 0; }
.sidebar-card {
  background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border);
  padding: 1.5rem;
}
.sidebar-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-main); }
.sidebar-desc { font-size: 0.85rem; color: var(--text-sub); margin-bottom: 1.5rem; line-height: 1.5; }
.sidebar-stat { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 1rem; }
.stat-num { font-size: 1.4rem; font-weight: 700; color: var(--text-main); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* MAIN AREA */
.main-content { flex: 1; min-width: 0; }
.toolbar { display: flex; justify-content: space-between; margin-bottom: 1.5rem; }
.toolbar-actions { display: flex; gap: 0.5rem; }
.btn {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main);
  padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem; cursor: pointer;
  transition: 0.2s; font-weight: 500; display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: #f1f5f9; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: #1d4ed8; }

/* LIST TABLE */
.list-container {
  background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border);
  overflow: hidden;
}
.list-header {
  display: flex; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
  font-size: 0.70rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.5px;
}
.col-device { flex: 2; }
.col-cpu { flex: 1; min-width: 120px; }
.col-ram { flex: 1; min-width: 120px; }
.col-actions { flex: 1; text-align: right; min-width: 120px; }

.list-row {
  display: flex; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
  align-items: center; transition: background 0.2s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: #f8fafc; }
.list-row.offline { opacity: 0.5; filter: grayscale(1); }

/* DEVICE CELL */
.avatar-wrapper { position: relative; margin-right: 1rem; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent-light);
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 1rem;
}
.status-dot {
  position: absolute; bottom: -2px; right: -2px; width: 14px; height: 14px;
  background: var(--success); border: 2.5px solid white; border-radius: 50%;
}
.device-info { display: flex; flex-direction: column; }
.device-name { font-size: 0.95rem; font-weight: 600; color: var(--text-main); margin-bottom: 3px; }
.device-sub { font-size: 0.75rem; color: var(--text-sub); display: flex; align-items: center; gap: 4px; }
.os-icon { width: 14px; height: 14px; opacity: 0.7; }

/* METRICS */
.cpu-block { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.badge {
  background: var(--accent-light); color: var(--accent); padding: 5px 12px;
  border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.action-group { display: flex; gap: 6px; justify-content: flex-end; }

/* MODAL INVENTORY */
.modal { position:fixed; z-index:100; left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,0.4); display:none; justify-content:center; align-items:center;}
.modal-content { background:white; border-radius:12px; width:500px; max-height:80vh; display:flex; flex-direction:column; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); border:1px solid var(--border); }
.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
.modal-header h2 { margin:0; font-size:1.1rem; color:var(--text-main);}
.close-btn { cursor:pointer; font-size:1.5rem; color:var(--text-muted); line-height:1; }
.close-btn:hover { color: var(--danger); }
.modal-body { padding:1.5rem; overflow:hidden; display:flex; flex-direction:column; gap:1rem;}
.search-input { width:100%; padding:0.6rem 1rem; border:1px solid var(--border); border-radius:6px; font-family:inherit; color:var(--text-main); background:#fafafa;}
.search-input:focus { outline: none; border-color: var(--accent); background:white;}
.software-list { overflow-y:auto; flex:1;}
.software-item { display:flex; justify-content:space-between; padding:0.5rem 0; border-bottom:1px solid var(--border); font-size:0.85rem;}
.software-version { color:var(--text-muted); text-align:right;}
.software-list::-webkit-scrollbar { width: 6px; }
.software-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* MODAL DETALLES */
.metrics-grid {
    display: flex; gap: 1.5rem; justify-content: center; margin-bottom: 1rem;
}
.metric-card {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    background: #f8fafc; padding: 20px; border-radius: 12px; border: 1px solid var(--border);
    flex: 1; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}
.metric-card h4 { margin: 0; color: var(--text-sub); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px;}
.donut {
    width: 100px; height: 100px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    position: relative; transition: background 0.3s ease;
}
.donut::before {
    content: ''; position: absolute; width: 76px; height: 76px; background: #f8fafc; border-radius: 50%;
}
.donut span { position: relative; font-weight: 700; color: var(--text-main); font-size: 1.1rem; }

.details-list { border-top: 1px solid var(--border); padding-top: 1.5rem; display: flex; flex-direction: column; gap: 12px; }
.detail-row { display: flex; justify-content: space-between; font-size: 0.95rem; background: #f1f5f9; padding: 10px 15px; border-radius: 6px;}
.detail-row strong { color: var(--text-main); font-weight: 600;}
.detail-row span { color: var(--text-sub); }
