/* ============================================================
   MADIUNKAB UNIFIED OPERATIONS PORTAL - LUXURY DARK DESIGN SYSTEM
   ============================================================ */

:root {
  --bg-primary: #070b14;
  --bg-secondary: #0d1527;
  --bg-card: rgba(16, 26, 46, 0.75);
  --bg-card-hover: rgba(23, 37, 66, 0.85);
  --bg-input: rgba(10, 18, 34, 0.8);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.3);
  --border-active: #38bdf8;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.15);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Ambient Ambient Glows */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent 70%);
  top: -100px;
  right: -100px;
}
.glow-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12), transparent 70%);
  bottom: 50px;
  left: 200px;
}
.glow-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.1), transparent 70%);
  top: 40%;
  right: 25%;
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 290px;
  background: rgba(11, 18, 33, 0.85);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px 20px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

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

.logo-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}

.brand-text h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
  line-height: 1.2;
}

.badge-gateway {
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.btn-sidebar-toggle:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

/* Nav Menu */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.nav-group-title {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  color: var(--text-dim);
  padding: 0 10px 8px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition);
  position: relative;
}

.nav-item i:not(.external-icon) {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: var(--text-dim);
  transition: var(--transition);
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}
.nav-item:hover i:not(.external-icon) {
  color: var(--accent-cyan);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.15), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-weight: 600;
}
.nav-item.active i {
  color: var(--accent-cyan);
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
}
.nav-badge.pulse {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}
.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 20px;
}
.status-dot {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}
.external-icon {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-dim);
}

/* User Profile Box */
.sidebar-user {
  padding: 16px 18px;
  background: rgba(7, 12, 22, 0.7);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b, #334155);
  border: 2px solid var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 15px;
  position: relative;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.avatar-status {
  width: 10px;
  height: 10px;
  background: var(--accent-emerald);
  border: 2px solid var(--bg-primary);
  border-radius: 50%;
  position: absolute;
  bottom: 0;
  right: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================
   MAIN WRAPPER & TOPBAR
   ============================================================ */
.main-wrapper {
  flex: 1;
  margin-left: 290px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.topbar {
  height: 72px;
  background: rgba(11, 18, 33, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  width: 380px;
  transition: var(--transition);
}
.search-box:focus-within {
  border-color: var(--border-active);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}
.search-box i {
  color: var(--text-dim);
  font-size: 14px;
}
.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 13.5px;
  width: 100%;
}
.search-box input::placeholder {
  color: var(--text-dim);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.system-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.speed-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 14px;
  background: rgba(16, 26, 46, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.speed-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-ai-sentinel {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.3));
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}
.btn-ai-sentinel:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(168, 85, 247, 0.5));
  border-color: var(--accent-purple);
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.4);
  transform: translateY(-1px);
}

/* ============================================================
   CONTENT BODY & VIEWS
   ============================================================ */
.content-body {
  padding: 32px;
  flex: 1;
}

.tab-view {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}
.tab-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Page Title Box */
.page-title-box {
  margin-bottom: 24px;
}
.page-title-box h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
}
.page-title-box p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* ============================================================
   VIEW 1: DASHBOARD OVERVIEW COMPONENTS
   ============================================================ */

/* Welcome Banner */
.welcome-banner {
  background: linear-gradient(135deg, rgba(16, 28, 54, 0.8), rgba(12, 19, 36, 0.9));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 32px 36px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.welcome-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), var(--accent-indigo), transparent);
}

.banner-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 14px;
}

.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

.welcome-banner h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.25;
  margin-bottom: 10px;
}

.gradient-text {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-indigo), var(--accent-emerald));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-banner p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 680px;
}

.banner-stats {
  display: flex;
  gap: 24px;
  background: rgba(8, 14, 27, 0.6);
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}
.b-stat {
  display: flex;
  flex-direction: column;
  text-align: center;
}
.b-val {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
}
.b-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}
.metric-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
}

.card-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.icon-cyan { background: rgba(56, 189, 248, 0.15); color: var(--accent-cyan); }
.icon-purple { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.icon-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.icon-pink { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.icon-red { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

.card-data {
  display: flex;
  flex-direction: column;
}
.card-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.card-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin: 3px 0;
}
.card-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Resource Section */
.resource-section {
  background: var(--bg-card);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  margin-bottom: 30px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}
.section-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.update-indicator {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.resource-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.res-card {
  background: rgba(11, 19, 36, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}
.res-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.res-val {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
}

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s ease-in-out;
}
.fill-cpu { background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald)); }
.fill-mem { background: linear-gradient(90deg, var(--accent-indigo), var(--accent-purple)); }
.fill-disk { background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan)); }
.fill-threads { background: linear-gradient(90deg, var(--accent-amber), var(--accent-red)); }

.res-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* ============================================================
   GEOSPATIAL MAP SECTION
   ============================================================ */
.map-section {
  background: var(--bg-card);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 26px;
  margin-bottom: 30px;
}

.map-actions {
  display: flex;
  gap: 8px;
}
.btn-map-filter {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-map-filter:hover, .btn-map-filter.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: var(--text-main);
}
.btn-map-filter.btn-attack.active {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--accent-red);
  color: #fff;
}

.map-container-wrapper {
  height: 440px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  position: relative;
  margin-top: 18px;
}
#geospatialMap {
  width: 100%;
  height: 100%;
  background: #060b17;
}

/* Map Legend */
.map-legend {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: rgba(9, 16, 31, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  z-index: 1000;
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
.legend-title {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.5px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.color-dc { background: #10b981; box-shadow: 0 0 8px #10b981; }
.color-app { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.color-proxy { background: #a855f7; box-shadow: 0 0 8px #a855f7; }
.color-attack { background: #ef4444; box-shadow: 0 0 8px #ef4444; }

/* Traffic Table */
.traffic-log-card {
  margin-top: 20px;
  background: rgba(9, 16, 31, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}
.traffic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.traffic-header h3 {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.badge-status-sync {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  padding: 3px 8px;
  border-radius: 20px;
}

.table-responsive {
  overflow-x: auto;
}
.traffic-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.traffic-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
}
.traffic-table td {
  padding: 10px 12px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.traffic-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
}

.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.status-allowed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}
.status-blocked {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}
.status-hq {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
}

/* ============================================================
   APPS GRID (LAUNCHPAD)
   ============================================================ */
.launchpad-section {
  margin-bottom: 30px;
}
.link-view-all {
  color: var(--accent-cyan);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.link-view-all:hover {
  text-decoration: underline;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.app-card {
  background: var(--bg-card);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
}
.app-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
  background: var(--bg-card-hover);
}

.app-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.app-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(99, 102, 241, 0.15));
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--accent-cyan);
  transition: var(--transition);
}
.app-card:hover .app-card-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.app-badge-category {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.app-card h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-card h3 i {
  font-size: 13px;
  color: var(--text-dim);
  opacity: 0;
  transform: translateX(-4px);
  transition: var(--transition);
}
.app-card:hover h3 i {
  opacity: 1;
  transform: translateX(0);
  color: var(--accent-cyan);
}

.app-card p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
  margin-bottom: 16px;
}

.app-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 12px;
  font-size: 11.5px;
}
.app-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-emerald);
  font-weight: 600;
}
.app-port {
  color: var(--text-dim);
  font-family: monospace;
}

/* View 2: Filters */
.catalog-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.btn-cat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-cat:hover, .btn-cat.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(99, 102, 241, 0.2));
  border-color: var(--accent-cyan);
  color: #fff;
}

/* View 3 & 4 Grid Cards */
.security-cards-grid, .latency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.sec-card, .lat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.sec-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sec-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13.5px;
}
.sec-list li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 8px;
}

.lat-card h4 {
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 8px;
}
.lat-val {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
}
.lat-card span {
  font-size: 12px;
  color: var(--text-dim);
}

/* ============================================================
   AI SENTINEL DRAWER
   ============================================================ */
.ai-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: rgba(12, 19, 36, 0.95);
  backdrop-filter: blur(25px);
  border-left: 1px solid rgba(168, 85, 247, 0.3);
  z-index: 200;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.ai-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.drawer-title i {
  font-size: 22px;
}
.drawer-title h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.drawer-title span {
  font-size: 11px;
  color: var(--text-muted);
}
.btn-close-drawer {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  transition: var(--transition);
}
.btn-close-drawer:hover {
  color: #fff;
}

.drawer-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
}
.msg-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.ai-msg .msg-icon {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
  color: #fff;
}
.user-msg {
  margin-left: auto;
  flex-direction: row-reverse;
}
.user-msg .msg-icon {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
}
.msg-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-main);
}
.user-msg .msg-bubble {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
}

.drawer-footer {
  padding: 16px 20px 20px 20px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(8, 13, 25, 0.8);
}
.quick-prompts {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.btn-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.btn-chip:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: var(--accent-purple);
  color: #fff;
}

.ai-input-form {
  display: flex;
  gap: 8px;
}
.ai-input-form input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 13px;
  outline: none;
}
.ai-input-form input:focus {
  border-color: var(--accent-purple);
}
.btn-send-ai {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}
.btn-send-ai:hover {
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
}

/* Helpers */
.text-emerald { color: var(--accent-emerald) !important; }
.text-blue { color: var(--accent-blue) !important; }
.text-cyan { color: var(--accent-cyan) !important; }
.text-purple { color: var(--accent-purple) !important; }
.text-amber { color: var(--accent-amber) !important; }
.text-red { color: var(--accent-red) !important; }

/* Responsive */
@media (max-width: 1024px) {
  .sidebar { width: 80px; }
  .sidebar .brand-text, .sidebar .nav-group-title, .sidebar .nav-item span, .sidebar .nav-badge, .sidebar .nav-count, .sidebar .user-info, .sidebar .external-icon {
    display: none;
  }
  .sidebar-header { justify-content: center; padding: 20px 0; }
  .nav-item { justify-content: center; padding: 12px; }
  .sidebar-user { justify-content: center; }
  .main-wrapper { margin-left: 80px; }
}

@media (max-width: 768px) {
  .welcome-banner { flex-direction: column; align-items: flex-start; gap: 20px; }
  .topbar { padding: 0 16px; }
  .search-box { width: 200px; }
  .system-pills { display: none; }
  .content-body { padding: 16px; }
  .ai-drawer { width: 100%; right: -100%; }
}
