:root {
  --primary: #3F51B5;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #F44336;
  --info: #2196F3;
  --sidebar-width: 240px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #F5F5F5;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: #263238;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar .nav-link {
  color: #B0BEC5;
  border-radius: 0.375rem;
  margin-bottom: 0.15rem;
  padding: 0.6rem 0.75rem;
}

.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar .nav-link.active {
  background: var(--primary);
  color: #fff;
}

@media (max-width: 991px) {
  #wrapper { flex-direction: column; }
  .sidebar { width: 100%; min-height: auto; }
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

/* Cards / stats */
.stat-card {
  border: none;
  border-radius: 0.75rem;
  color: #fff;
}

.stat-card .bi { opacity: 0.85; }

/* Tables */
.table-hover tbody tr { cursor: pointer; }
.badge-online { background: var(--success); }
.badge-offline { background: var(--danger); }
.badge-expired { background: var(--warning); }

.tag-badge {
  display: inline-block;
  color: #fff;
  border-radius: 0.25rem;
  padding: 0.15rem 0.5rem;
  margin: 0.1rem;
  font-size: 0.8rem;
}

.device-uid { font-family: 'Consolas', monospace; font-size: 0.85rem; }

/* Detail page */
.detail-section {
  background: #fff;
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.detail-section h6 {
  color: var(--primary);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.key-value { font-size: 0.9rem; }
.key-value dt { color: #666; font-weight: 500; }

/* Code blocks */
.code-box {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 0.5rem;
  font-family: 'Consolas', monospace;
  font-size: 0.8rem;
  max-height: 300px;
  overflow: auto;
}

/* Toast */
.toast { z-index: 1080; }

/* Chart wrapper */
.chart-box {
  background: #fff;
  border-radius: 0.5rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 1rem;
}

/* Filters row */
.filter-bar .form-control, .filter-bar .form-select { font-size: 0.9rem; }