/* ═══════════════════════════════════════════════════════════════════════════
   LUNAR NETWORK — DARK SPACE THEME
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg-deep:       #050814;
  --bg-surface:    #0c1024;
  --bg-card:       rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --border:        rgba(255,255,255,0.08);
  --border-glow:   rgba(6,182,212,0.3);

  --cyan:    #06b6d4;
  --purple:  #7c3aed;
  --violet:  #a78bfa;
  --pink:    #ec4899;
  --green:   #10b981;
  --orange:  #f97316;
  --red:     #ef4444;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --sidebar-w: 240px;
  --radius:    12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-deep);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ── Star Field ─────────────────────────────────────────────────────────── */
.stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  animation: twinkle var(--dur, 3s) var(--delay, 0s) infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0; }
  50%       { opacity: 0.8; }
}
.nebula {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 30%, rgba(124,58,237,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 70%, rgba(6,182,212,0.1) 0%, transparent 70%);
}

/* ── Glass Card ─────────────────────────────────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.glass-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 30px rgba(6,182,212,0.05);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 10;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  justify-content: center;
}
.logo-icon { display: flex; align-items: center; }
.logo-text { display: flex; flex-direction: column; }
.logo-name {
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-tagline { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.05em; }

.login-card { padding: 2rem; }

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.login-subtitle { color: var(--text-secondary); margin-bottom: 1.75rem; }

/* Flash */
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.flash-error  { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.flash-success{ background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }

/* Form */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.forgot-link { color: var(--cyan); font-size: 0.75rem; text-decoration: none; }
.forgot-link:hover { color: var(--violet); }

.input-wrapper { position: relative; display: flex; align-items: center; }
.input-icon {
  position: absolute;
  left: 0.875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}
.form-input {
  width: 100%;
  padding: 0.75rem 2.5rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.15);
  background: rgba(6,182,212,0.04);
}
.toggle-password {
  position: absolute;
  right: 0.875rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}
.toggle-password:hover { color: var(--text-secondary); }

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}
.checkbox {
  width: 16px; height: 16px;
  accent-color: var(--cyan);
  cursor: pointer;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity var(--transition), transform var(--transition);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: border-color var(--transition), color var(--transition);
}
.btn-outline:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.78rem; }

/* Demo accounts */
.login-demo { margin-top: 1.5rem; }
.demo-label { font-size: 0.75rem; color: var(--text-muted); text-align: center; margin-bottom: 0.75rem; }
.demo-accounts { display: flex; gap: 0.75rem; }
.demo-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition), background var(--transition);
}
.demo-btn:hover { border-color: var(--cyan); background: rgba(6,182,212,0.05); }
.demo-role {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.demo-role.client { background: rgba(6,182,212,0.2); color: var(--cyan); }
.demo-role.admin  { background: rgba(124,58,237,0.2); color: var(--violet); }

.login-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 1.5rem;
}

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════════════════
   APP LAYOUT (Dashboard + Admin)
   ═══════════════════════════════════════════════════════════════════════════ */
.app-body { background: var(--bg-deep); min-height: 100vh; }

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(5,8,20,0.95);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.logo-name {
  font-size: 0.95rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.admin-badge {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--violet);
  -webkit-text-fill-color: var(--violet);
  background: none;
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(6,182,212,0.15), rgba(124,58,237,0.15));
  color: var(--cyan);
  border: 1px solid rgba(6,182,212,0.2);
}
.nav-badge {
  margin-left: auto;
  background: rgba(6,182,212,0.2);
  color: var(--cyan);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.nav-badge.danger { background: rgba(239,68,68,0.2); color: var(--red); }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.user-info { display: flex; align-items: center; gap: 0.625rem; flex: 1; min-width: 0; }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.admin-avatar { background: linear-gradient(135deg, var(--purple), var(--pink)); }
.user-details { min-width: 0; }
.user-name { display: block; font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 0.7rem; color: var(--text-muted); }
.admin-role { color: var(--violet); }
.btn-logout {
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.btn-logout:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* ── Main Content ───────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar ────────────────────────────────────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.75rem;
  background: rgba(5,8,20,0.8);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.top-bar-left { display: flex; align-items: center; gap: 1rem; }
.top-bar-right { display: flex; align-items: center; gap: 1rem; }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
}

.page-title { font-size: 1.1rem; font-weight: 700; }
.page-sub { font-size: 0.8rem; color: var(--text-secondary); }

.status-pill {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
}
.status-pill.online { background: rgba(16,185,129,0.1); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }

.notif-wrapper { position: relative; }
.notif-btn {
  position: relative;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0.375rem;
  border-radius: var(--radius-sm);
}
.notif-btn:hover { color: var(--text-primary); }
.notif-dot {
  position: absolute; top: 2px; right: 2px;
  width: 8px; height: 8px;
  background: var(--cyan);
  border-radius: 50%;
  border: 2px solid var(--bg-deep);
}
.danger-dot { background: var(--red); }

/* ── Notification Dropdown ───────────────────────────────────────────────── */
.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  z-index: 200;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }
.notif-drop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.notif-drop-count {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.notif-drop-count.zero { background: var(--bg-hover); color: var(--text-muted); }
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-item:last-child { border-bottom: none; }
.notif-item-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.notif-item-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.notif-item-status { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; text-transform: capitalize; padding-top: 2px; }
.notif-empty { padding: 1.5rem 1rem; text-align: center; color: var(--text-muted); font-size: 0.82rem; }

/* ── Clickable Stat Cards ────────────────────────────────────────────────── */
.stat-card-link { cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.stat-card-link:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(6,182,212,0.15); }

/* ── Tab System ─────────────────────────────────────────────────────────── */
.tab-content {
  display: none;
  padding: 1.75rem;
  flex: 1;
}
.tab-content.active { display: block; }

/* ── Stats Grid ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.four-col { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.it-icon    { background: rgba(6,182,212,0.12);  color: var(--cyan); }
.net-icon   { background: rgba(167,139,250,0.12); color: var(--violet); }
.web-icon   { background: rgba(16,185,129,0.12);  color: var(--green); }
.cloud-icon { background: rgba(249,115,22,0.12);  color: var(--orange); }

.stat-info { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.1rem; }
.stat-value { font-size: 1.4rem; font-weight: 700; }

/* ── Two Column ─────────────────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

/* ── Card components ────────────────────────────────────────────────────── */
.card-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 1rem; }
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.filter-row { display: flex; gap: 0.5rem; }

/* ── Health Bars ────────────────────────────────────────────────────────── */
.health-list { display: flex; flex-direction: column; gap: 1rem; }
.health-item { display: flex; align-items: center; gap: 0.75rem; }
.health-label { font-size: 0.8rem; color: var(--text-secondary); width: 90px; flex-shrink: 0; }
.health-bar { flex: 1; height: 6px; background: rgba(255,255,255,0.07); border-radius: 3px; overflow: hidden; }
.health-fill { height: 100%; border-radius: 3px; transition: width 1s ease; }
.it-color    { background: linear-gradient(90deg, var(--cyan), #0284c7); }
.net-color   { background: linear-gradient(90deg, var(--violet), var(--purple)); }
.web-color   { background: linear-gradient(90deg, var(--green), #059669); }
.cloud-color { background: linear-gradient(90deg, var(--orange), #ea580c); }
.health-pct  { font-size: 0.78rem; font-weight: 600; width: 36px; text-align: right; color: var(--text-secondary); }

/* ── Ticket List ────────────────────────────────────────────────────────── */
.ticket-list { display: flex; flex-direction: column; gap: 0.75rem; }
.ticket-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.ticket-id   { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); width: 60px; flex-shrink: 0; }
.ticket-subj { flex: 1; font-size: 0.85rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-high     { background: rgba(239,68,68,0.2);   color: #fca5a5; }
.badge-medium   { background: rgba(249,115,22,0.2);  color: #fdba74; }
.badge-low      { background: rgba(6,182,212,0.2);   color: var(--cyan); }
.badge-open     { background: rgba(239,68,68,0.15);  color: #fca5a5; }
.badge-in-progress { background: rgba(249,115,22,0.15); color: #fdba74; }
.badge-resolved { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-active   { background: rgba(6,182,212,0.15);  color: var(--cyan); }
.badge-healthy  { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-degraded { background: rgba(249,115,22,0.2);  color: #fdba74; }
.badge-enterprise { background: rgba(167,139,250,0.2); color: var(--violet); }
.badge-professional { background: rgba(6,182,212,0.2); color: var(--cyan); }
.badge-internal { background: rgba(16,185,129,0.2); color: var(--green); }

/* ── Data Table ─────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Progress Bar ───────────────────────────────────────────────────────── */
.progress-bar-wrap { background: rgba(255,255,255,0.07); border-radius: 4px; height: 6px; min-width: 80px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--cyan), var(--purple)); }

/* ── Project Cards ──────────────────────────────────────────────────────── */
.project-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
}
.project-info .proj-name { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.25rem; }
.project-info .proj-tech { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.project-meta { text-align: right; }
.project-meta .proj-pct { font-size: 1.2rem; font-weight: 700; color: var(--cyan); }
.project-meta .proj-deadline { font-size: 0.72rem; color: var(--text-muted); }

/* ── CPU Bar ─────────────────────────────────────────────────────────────── */
.cpu-bar { display: flex; align-items: center; gap: 0.5rem; }
.cpu-mini { width: 60px; height: 4px; background: rgba(255,255,255,0.07); border-radius: 2px; overflow: hidden; }
.cpu-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--green), var(--cyan)); }

/* ── Activity Feed ──────────────────────────────────────────────────────── */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.act-ticket  { background: var(--red); }
.act-deploy  { background: var(--green); }
.act-alert   { background: var(--orange); }
.act-login   { background: var(--cyan); }
.act-resolved{ background: var(--violet); }
.activity-text { flex: 1; font-size: 0.83rem; color: var(--text-secondary); }
.activity-time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.activity-feed.large .activity-item { padding: 1rem 0; }

/* ── Service Cards ──────────────────────────────────────────────────────── */
.services-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.service-card { padding: 1.5rem; }
.service-header { display: flex; align-items: center; gap: 0.875rem; margin-bottom: 1.25rem; }
.service-header h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.service-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.service-status { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; font-weight: 500; }
.service-status.online { color: var(--green); }
.service-status.online::before { content:''; display:inline-block; width:6px; height:6px; background:var(--green); border-radius:50%; }

.service-stats { display: flex; gap: 1.5rem; margin-bottom: 1rem; }
.service-stats > div { display: flex; flex-direction: column; }
.s-num { font-size: 1.1rem; font-weight: 700; }
.s-lbl { font-size: 0.7rem; color: var(--text-muted); }
.service-desc { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }

.it-border    { border-left: 3px solid var(--cyan); }
.net-border   { border-left: 3px solid var(--violet); }
.web-border   { border-left: 3px solid var(--green); }
.cloud-border { border-left: 3px solid var(--orange); }

/* ── Select Input ───────────────────────────────────────────────────────── */
.select-input {
  padding: 0.4rem 0.75rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.select-input:focus { border-color: var(--cyan); }
.select-input option { background: #0c1024; }

/* ── Link style in tables ───────────────────────────────────────────────── */
.action-link { font-size: 0.78rem; color: var(--cyan); text-decoration: none; cursor: pointer; }
.action-link:hover { color: var(--violet); }

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal {
  background: #0c1024;
  border: 1px solid rgba(6,182,212,0.25);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
  border-radius: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 1.5rem; }
.modal-body .form-group { margin-bottom: 1rem; }
.modal-body .form-label { font-size: 0.78rem; font-weight: 500; color: var(--text-secondary); display: block; margin-bottom: 0.4rem; }
.modal-body .form-input,
.modal-body .select-input,
.modal-body textarea.form-input {
  width: 100%;
  padding: 0.65rem 0.875rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.modal-body .form-input:focus,
.modal-body .select-input:focus,
.modal-body textarea.form-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.12);
}
.modal-body textarea.form-input { resize: vertical; min-height: 80px; }
.modal-body .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem; }

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ── Toast notifications ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toast-in 0.2s ease;
  max-width: 320px;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.toast-error   { background: rgba(239,68,68,0.15);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }

/* ── Danger button ───────────────────────────────────────────────────────── */
.btn-danger {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.875rem;
  background: rgba(239,68,68,0.15);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background var(--transition);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* ── Badge suspended ─────────────────────────────────────────────────────── */
.badge-suspended { background: rgba(239,68,68,0.15); color: #fca5a5; }
.badge-closed    { background: rgba(100,116,139,0.2); color: #94a3b8; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.act-system { background: var(--text-muted); }

/* ── RF Sensing ─────────────────────────────────────────────────────────── */
.sensing-privacy-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: rgba(6,182,212,0.07);
  border: 1px solid rgba(6,182,212,0.2);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 1.75rem 1.75rem 1rem;
}
.sensing-privacy-banner svg { flex-shrink: 0; color: var(--cyan); margin-top: 1px; }

.sensing-device-card { padding: 1.5rem; }
.sensing-device-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.sensing-device-name { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.sensing-device-loc  { font-size: 0.78rem; color: var(--text-muted); }
.sensing-status-group { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.sensing-status-pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
}
.sensing-status-pill.online  { background: rgba(16,185,129,0.12); color: var(--green); }
.sensing-status-pill.offline { background: rgba(100,116,139,0.15); color: var(--text-muted); }
.sensing-last-seen { font-size: 0.72rem; color: var(--text-muted); }
.sensing-timestamp  { font-size: 0.72rem; color: var(--text-muted); margin-top: 1rem; text-align: right; }

.occupancy-display {
  text-align: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.occupancy-number {
  font-size: 4rem; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.occupancy-label   { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
.occupancy-activity { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.3rem; }

.persons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.person-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.person-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.75rem;
}
.person-label { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.pose-badge {
  font-size: 0.72rem; padding: 0.15rem 0.5rem;
  background: rgba(6,182,212,0.1); color: var(--cyan);
  border-radius: 999px;
}
.vitals-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem; text-align: center;
}
.vital-item { padding: 0.4rem; }
.vital-icon  { font-size: 1rem; margin-bottom: 0.2rem; }
.vital-val   { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); }
.vital-unit  { font-size: 0.65rem; font-weight: 400; color: var(--text-muted); }
.vital-label { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.15rem; }
.person-zone { font-size: 0.72rem; color: var(--text-muted); text-align: center; margin-top: 0.5rem; }

.signal-quality-row {
  display: flex; align-items: center; gap: 0.75rem;
  border-top: 1px solid var(--border); padding-top: 1rem;
}
.signal-label    { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.signal-bar-track {
  flex: 1; height: 6px; background: rgba(255,255,255,0.08);
  border-radius: 999px; overflow: hidden;
}
.signal-bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  transition: width 0.5s ease;
}
.signal-pct { font-size: 0.78rem; font-weight: 600; color: var(--cyan); white-space: nowrap; }

/* Admin sensing — API key box & code block */
.api-key-box {
  font-family: monospace;
  font-size: 0.82rem;
  padding: 0.6rem 0.875rem;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--cyan);
  word-break: break-all;
  user-select: all;
}
.code-block {
  font-family: monospace;
  font-size: 0.75rem;
  padding: 0.875rem;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIMULATION PANEL
   ═══════════════════════════════════════════════════════════════════════════ */
.sim-panel { border-color: rgba(124,58,237,0.25); }
.sim-tag {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 0.2rem 0.6rem;
  background: rgba(124,58,237,0.15); color: var(--violet);
  border: 1px solid rgba(124,58,237,0.3); border-radius: 999px;
}
.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.sim-control { display: flex; flex-direction: column; gap: 0.5rem; }
.sim-label { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.sim-slider-row { display: flex; align-items: center; gap: 0.75rem; }
.sim-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  outline: none;
  cursor: pointer;
}
.sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  cursor: pointer;
  border: 2px solid var(--bg-deep);
}
.sim-val { font-size: 0.78rem; font-weight: 700; color: var(--cyan); min-width: 52px; text-align: right; }
.sim-select { padding: 0.5rem 0.75rem; font-size: 0.85rem; }
.sim-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--red), #b91c1c);
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: opacity var(--transition);
}
.btn-danger:hover { opacity: 0.88; }

/* ═══════════════════════════════════════════════════════════════════════════
   SENSING — New UI Classes
   ═══════════════════════════════════════════════════════════════════════════ */

/* Live dot */
.live-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.live-dot.live-green { background: var(--green); box-shadow: 0 0 6px rgba(16,185,129,0.6); }
.live-dot.live-grey  { background: var(--text-muted); }
.live-dot.pulse      { animation: livePulse 0.8s ease-out; }
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* Mode badge */
.mode-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.68rem; font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.05em;
  vertical-align: middle; margin-left: 0.5rem;
}
.mode-badge.office   { background: rgba(6,182,212,0.12);  color: var(--cyan);   border: 1px solid rgba(6,182,212,0.25); }
.mode-badge.security { background: rgba(239,68,68,0.12);  color: var(--red);    border: 1px solid rgba(239,68,68,0.25); }

/* Security status */
.sec-status {
  text-align: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}
.sec-status.clear { background: rgba(16,185,129,0.1); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.sec-status.alert { background: rgba(239,68,68,0.12); color: var(--red);   border: 1px solid rgba(239,68,68,0.3); animation: alertPulse 1.5s ease-in-out infinite; }
@keyframes alertPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50%      { box-shadow: 0 0 12px 2px rgba(239,68,68,0.2); }
}

/* Office capacity bar */
.office-capacity-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.cap-label { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.cap-track { flex: 1; height: 8px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.cap-fill  { height: 100%; border-radius: 999px; transition: width 0.6s ease, background 0.4s; }
.cap-val   { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; min-width: 60px; text-align: right; }

/* Activity dot */
.activity-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.act-empty   { background: var(--text-muted); }
.act-still   { background: var(--cyan); }
.act-moving  { background: var(--green); animation: livePulse 1.2s ease-out infinite; }
.act-unknown { background: var(--text-muted); }

/* Alert log */
.alert-log-row {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}
.alert-log-row:last-child { border-bottom: none; }
.alert-log-row.afterHours { border-left: 3px solid var(--violet); }
.alert-log-row.intrusion  { border-left: 3px solid var(--red); }
.alert-log-row.capacity   { border-left: 3px solid var(--orange); }
.alert-log-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.1rem; }
.alert-log-body { flex: 1; min-width: 0; }
.alert-log-msg  { font-size: 0.82rem; font-weight: 500; color: var(--text-primary); }
.alert-log-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 900px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  /* Overlay when sidebar open */
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.show { display: block; }

  .main-content  { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .two-col   { grid-template-columns: 1fr; }
  .four-col  { grid-template-columns: repeat(2, 1fr); }
  .services-grid { grid-template-columns: 1fr; }

  .top-bar { padding: 0.875rem 1.25rem; }
  .tab-content { padding: 1.25rem; }
  .tab-content.active { padding: 1.25rem; }

  .form-row { grid-template-columns: 1fr; }

  .modal { width: 95vw; max-width: 95vw; margin: 1rem; max-height: 90vh; overflow-y: auto; }

  .data-table { font-size: 0.78rem; }
  .data-table th, .data-table td { padding: 0.6rem 0.75rem; }

  .sensing-privacy-banner { margin: 1rem 1rem 0.75rem; }
  .sensing-device-card { padding: 1.25rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Phone (≤ 600px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  :root { --sidebar-w: 260px; }

  /* Top bar */
  .top-bar { padding: 0.75rem 1rem; gap: 0.5rem; }
  .top-bar-right .status-pill { display: none; }
  .page-sub { display: none; }
  .page-title { font-size: 0.95rem; }

  /* Tab content */
  .tab-content, .tab-content.active { padding: 0.875rem; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.625rem; }
  .four-col   { grid-template-columns: 1fr 1fr; }
  .stat-card  { padding: 1rem; }
  .stat-value { font-size: 1.5rem; }
  .stat-icon  { font-size: 1.5rem; }

  /* Glass card */
  .glass-card { padding: 1rem; }
  .card-header-row { flex-wrap: wrap; gap: 0.5rem; }

  /* Buttons — larger touch targets */
  .btn-primary, .btn-outline { padding: 0.75rem 1.25rem; min-height: 44px; }
  .btn-sm { min-height: 36px; }

  /* Forms */
  .form-row  { grid-template-columns: 1fr; gap: 0.75rem; }
  .form-input, .select-input { font-size: 16px; /* prevent iOS zoom */ min-height: 44px; }

  /* Modal — full screen on phone */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    width: 100vw; max-width: 100vw;
    border-radius: var(--radius) var(--radius) 0 0;
    margin: 0;
    max-height: 92vh;
    overflow-y: auto;
  }

  /* Tables — horizontal scroll */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 600px; font-size: 0.75rem; }
  .data-table th, .data-table td { padding: 0.5rem 0.625rem; white-space: nowrap; }

  /* Sensing tab */
  .sensing-privacy-banner { margin: 0.75rem 0 0.625rem; font-size: 0.75rem; }
  .sensing-device-card { padding: 1rem; }
  .sensing-device-header { flex-direction: column; gap: 0.625rem; }
  .sensing-status-group { flex-direction: row; align-items: center; }

  .occupancy-number { font-size: 3.5rem; }

  .persons-grid { grid-template-columns: 1fr; }
  .vitals-grid  { grid-template-columns: repeat(3, 1fr); gap: 0.375rem; }
  .vital-val    { font-size: 0.82rem; }

  .office-capacity-row { gap: 0.5rem; }
  .cap-val { min-width: 48px; font-size: 0.72rem; }

  .signal-quality-row { gap: 0.5rem; flex-wrap: wrap; }
  .sensing-timestamp  { width: 100%; text-align: left; }

  .alert-log-row { padding: 0.75rem; }
  .alert-log-msg { font-size: 0.78rem; }

  /* Nav items — bigger touch area */
  .nav-item { padding: 0.75rem; min-height: 44px; }

  /* Sidebar footer user info */
  .user-name { font-size: 0.75rem; }
  .user-role { font-size: 0.65rem; }

  /* Mode badge — wrap gracefully */
  .mode-badge { margin-left: 0; margin-top: 0.25rem; display: inline-flex; }
  .sensing-device-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }

  /* Login page on phone */
  .login-body { padding: 1.25rem; align-items: flex-start; padding-top: 3rem; }
  .form-input { font-size: 16px !important; min-height: 48px; } /* prevent iOS zoom */
  .login-card { padding: 1.5rem 1.25rem; }
  .login-title { font-size: 1.3rem; }
  .btn-primary.btn-full { min-height: 48px; font-size: 1rem; }
}
