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

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

:root {
  --bg-base: #09090b;
  --bg-raised: #0c0c0f;
  --bg-card: #111114;
  --bg-surface: #16161a;
  --bg-hover: #1c1c21;
  --bg-input: #0e0e11;
  --bg-inset: #0a0a0d;

  --border: #1f1f24;
  --border-subtle: #18181c;
  --border-hover: #2a2a30;
  --ring: rgba(161, 161, 170, 0.15);

  --accent: #a1a1aa;
  --accent-fg: #fafafa;
  --primary: #e4e4e7;
  --primary-hover: #f4f4f5;

  --destructive: #dc2626;
  --destructive-muted: rgba(220, 38, 38, 0.12);
  --warning: #d97706;
  --warning-muted: rgba(217, 119, 6, 0.12);
  --success: #16a34a;
  --success-muted: rgba(22, 163, 74, 0.12);
  --info: #6366f1;
  --info-muted: rgba(99, 102, 241, 0.12);

  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #52525b;
  --text-faint: #3f3f46;

  --font: 'Outfit', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', 'SF Mono', 'Consolas', monospace;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 200px;
  --sidebar-collapsed: 56px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.5;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

::selection { background: rgba(161, 161, 170, 0.2); }


.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-family: var(--font); font-weight: 500;
  transition: all 0.15s var(--ease); white-space: nowrap; line-height: 1;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--bg-base); font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--bg-base); }
.btn-outline { background: transparent; border-color: var(--border-hover); }
.btn-outline:hover { background: var(--bg-hover); border-color: var(--text-muted); color: var(--text); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text-secondary); background: var(--bg-hover); }
.btn-danger { background: transparent; border-color: var(--destructive); color: var(--destructive); }
.btn-danger:hover { background: var(--destructive-muted); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-alert { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); color: #fff; font-size: 11px; padding: 4px 12px; }
.btn-alert:hover { background: rgba(255,255,255,0.14); }


.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; color: var(--text-secondary);
  margin-bottom: 6px; font-weight: 500;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13px;
  font-family: var(--font); outline: none; transition: border-color 0.15s var(--ease);
  height: 42px;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--text-muted); box-shadow: 0 0 0 3px var(--ring);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-faint); }
.form-group textarea { resize: vertical; min-height: 60px; height: auto; }


#app-login {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: #09090b;
}
.login-bg-grid { display: none; }
.login-container { width: 100%; max-width: 320px; padding: 0 20px; }
.login-logo { display: none; }
.login-card {
  background: #0e0e12; border: 1px solid #27272a;
  border-radius: 6px; padding: 20px;
}
.login-card .form-group label { font-size: 11px; font-weight: 500; color: #52525b; text-transform: uppercase; letter-spacing: 0.5px; }
.login-card .form-group input { background: #14141a; border: 1px solid #27272a; border-radius: 4px; color: #fafafa; font-size: 13px; padding: 8px 10px; }
.login-card .form-group input:focus { border-color: #6366f1; }
.login-card .form-group input::placeholder { color: #3f3f46; }
.login-card .btn-full { height: 36px; font-size: 13px; background: #6366f1; border: none; border-radius: 4px; color: #fff; font-weight: 500; }
.login-card .btn-full:hover { background: #4f46e5; }
.login-error { color: #ef4444; font-size: 12px; text-align: center; min-height: 16px; margin-bottom: 6px; }


#app-customer-select {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-base);
}
.cs-container { width: 100%; max-width: 900px; padding: 0 24px; text-align: center; }
.cs-header { margin-bottom: 40px; }
.cs-logo { font-family: var(--font); font-size: 22px; font-weight: 800; letter-spacing: 8px; color: var(--text); margin-bottom: 8px; }
.cs-subtitle { font-size: 14px; color: var(--text-muted); font-weight: 400; }

.cs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 20px; text-align: left; }
.cs-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer; transition: all 0.15s var(--ease); position: relative; overflow: hidden;
}
.cs-card:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.cs-card-name { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.cs-card-color { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cs-card-stats { display: flex; gap: 20px; }
.cs-card-stat { display: flex; flex-direction: column; }
.cs-card-stat-val { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--text); }
.cs-card-stat-val.has-critical { color: var(--destructive); }
.cs-card-stat-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.cs-all-btn { width: 100%; max-width: 380px; margin: 0 auto 14px; display: block; padding: 12px; font-size: 14px; }
.cs-logout { margin: 0 auto; display: block; }


#app-dashboard { display: none; min-height: 100vh; }
#app-dashboard.active { display: flex; }
#app-customer-select { display: none; }

.sidebar {
  width: var(--sidebar-width); background: var(--bg-raised); border-right: 1px solid var(--border);
  flex-shrink: 0; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 200; transition: width 0.25s var(--ease);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-collapse-btn span { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .sidebar-collapse-btn { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar.collapsed .sidebar-nav { padding: 8px 6px; }
.sidebar.collapsed .sidebar-footer { padding: 8px 6px; }

.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px; color: var(--text); border-bottom: 1px solid var(--border);
}
.sidebar-logo-text { font-size: 15px; font-weight: 700; letter-spacing: 4px; }

.sidebar-nav { flex: 1; padding: 8px; overflow-y: auto; }

.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
  color: var(--text-muted); transition: all 0.12s var(--ease); margin-bottom: 2px; font-weight: 500;
  position: relative; border-left: 2px solid transparent;
}
.nav-item:hover { color: var(--text-secondary); background: var(--bg-hover); }
.nav-item.active {
  color: var(--text); border-left-color: var(--text-secondary);
}
.nav-item svg { flex-shrink: 0; width: 16px; height: 16px; }

.sidebar-footer {
  padding: 8px; border-top: 1px solid var(--border);
}
.sidebar-collapse-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 12px;
  color: var(--text-muted); background: none; border: none; width: 100%;
  font-family: var(--font); font-weight: 500; transition: all 0.12s var(--ease);
}
.sidebar-collapse-btn:hover { color: var(--text-secondary); background: var(--bg-hover); }
.sidebar-collapse-btn svg { flex-shrink: 0; transition: transform 0.25s var(--ease); }


.dashboard-main {
  flex: 1; margin-left: var(--sidebar-width); transition: margin-left 0.25s var(--ease);
  display: flex; flex-direction: column; min-height: 100vh;
}
.sidebar.collapsed ~ .dashboard-main,
body.sidebar-collapsed .dashboard-main { margin-left: var(--sidebar-collapsed); }


.header {
  background: var(--bg-raised); border-bottom: 1px solid var(--border);
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 20px; }
.header-customer-select select {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); padding: 5px 10px; font-size: 12px; font-family: var(--font); outline: none; cursor: pointer;
}
.header-customer-select select:hover { border-color: var(--border-hover); }
.header-right { display: flex; align-items: center; gap: 14px; }
.header-ws-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); font-family: var(--mono); }
.ws-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); transition: background 0.3s var(--ease); }
.ws-dot.online { background: var(--success); }
.ws-label { text-transform: uppercase; letter-spacing: 1px; font-weight: 500; }


.notification-wrapper { position: relative; }
.notification-bell {
  position: relative; background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 6px; border-radius: var(--radius-sm);
  transition: all 0.12s var(--ease); display: flex; align-items: center; justify-content: center;
}
.notification-bell:hover { color: var(--text-secondary); background: var(--bg-hover); }
.notification-badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
  background: var(--destructive); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; font-family: var(--mono);
}
.notification-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 380px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  display: none; z-index: 500;
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}
.notification-dropdown.open {
  display: block; opacity: 1; transform: translateY(0);
}
.notification-dropdown-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
}
.notification-list { max-height: 360px; overflow-y: auto; }
.notification-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle); cursor: pointer;
  transition: background 0.12s var(--ease);
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--bg-hover); }
.notification-item.unread { background: rgba(99, 102, 241, 0.04); }
.notification-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.notification-dot.critical { background: var(--destructive); }
.notification-dot.warning { background: var(--warning); }
.notification-dot.success { background: var(--success); }
.notification-dot.info { background: var(--info); }
.notification-text { flex: 1; min-width: 0; }
.notification-msg { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.notification-time { font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-top: 2px; }


.alert-bar {
  background: var(--destructive-muted); border-bottom: 1px solid rgba(220, 38, 38, 0.2);
}
.alert-bar-inner { display: flex; align-items: center; gap: 10px; padding: 8px 20px; color: var(--destructive); font-size: 13px; font-weight: 500; }
.alert-bar-inner svg { flex-shrink: 0; }
.alert-bar-inner span { flex: 1; }


.main-content { flex: 1; padding: 20px; overflow-y: auto; min-width: 0; }
.view { display: none; }
.view.active { display: block; }


.stats-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; align-items: center; gap: 14px; transition: border-color 0.15s var(--ease);
}
.stat-card:hover { border-color: var(--border-hover); }
.stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-agents .stat-icon { background: var(--info-muted); color: var(--info); }
.stat-devices .stat-icon { background: rgba(20, 184, 166, 0.1); color: #14b8a6; }
.stat-ports .stat-icon { background: rgba(161, 161, 170, 0.1); color: var(--text-secondary); }
.stat-critical .stat-icon { background: var(--destructive-muted); color: var(--destructive); }
.stat-warnings .stat-icon { background: var(--warning-muted); color: var(--warning); }
.stat-value { font-family: var(--mono); font-size: 24px; font-weight: 700; line-height: 1; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }


.view-toolbar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.toolbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.toolbar-search {
  flex: 1; min-width: 160px; padding: 8px 12px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text);
  font-size: 13px; font-family: var(--font); outline: none; transition: border-color 0.15s var(--ease);
}
.toolbar-search:focus { border-color: var(--text-muted); box-shadow: 0 0 0 3px var(--ring); }
.toolbar-search::placeholder { color: var(--text-faint); }
.toolbar-select {
  padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 13px;
  font-family: var(--font); outline: none; cursor: pointer;
}
.toolbar-select:hover { border-color: var(--border-hover); }


.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.ov-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.ov-security-panel { grid-column: span 2; }
.ov-timeline-panel { grid-column: span 2; }

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
}
.panel-body.scrollable { max-height: 320px; overflow-y: auto; }

.donut-body {
  display: flex; flex-direction: column; align-items: center; padding: 20px 16px;
  gap: 12px;
}
.donut-legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center;
}
.donut-legend-item {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary);
}
.donut-legend-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.donut-legend-count {
  font-family: var(--mono); font-weight: 600; color: var(--text);
}


.ov-agent-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle); transition: background 0.12s var(--ease);
}
.ov-agent-item:last-child { border-bottom: none; }
.ov-agent-item:hover { background: var(--bg-hover); }
.ov-agent-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ov-agent-dot.online { background: var(--success); }
.ov-agent-dot.offline { background: var(--text-faint); }
.ov-agent-info { flex: 1; min-width: 0; }
.ov-agent-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-agent-meta { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.ov-agent-badge {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 3px 10px; font-size: 11px; color: var(--text-muted); font-weight: 500; font-family: var(--mono);
}


.ov-issue-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle); cursor: pointer; transition: background 0.12s var(--ease);
}
.ov-issue-item:last-child { border-bottom: none; }
.ov-issue-item:hover { background: var(--bg-hover); }
.ov-issue-sev { width: 3px; height: 24px; border-radius: 2px; flex-shrink: 0; }
.ov-issue-sev.critical { background: var(--destructive); }
.ov-issue-sev.high { background: var(--destructive); }
.ov-issue-sev.medium { background: var(--warning); }
.ov-issue-sev.low { background: var(--info); }
.ov-issue-info { flex: 1; min-width: 0; }
.ov-issue-ip { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.ov-issue-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ov-issue-count {
  font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--destructive);
  background: var(--destructive-muted); padding: 2px 8px; border-radius: 20px;
}


.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.device-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; transition: all 0.12s var(--ease); border-left: 3px solid var(--border);
}
.device-card:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.device-card.severity-critical { border-left-color: var(--destructive); }
.device-card.severity-high { border-left-color: var(--destructive); }
.device-card.severity-medium { border-left-color: var(--warning); }
.device-card.severity-low { border-left-color: var(--info); }
.device-card.severity-clean { border-left-color: var(--success); }
.device-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.device-ip { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.device-type {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: 4px; background: var(--bg-surface); color: var(--text-muted);
  border: 1px solid var(--border); font-weight: 500;
}
.device-hostname { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.device-vendor { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.device-os {
  display: inline-block; font-family: var(--mono); font-size: 10px; padding: 2px 6px;
  border-radius: 4px; background: var(--bg-surface); color: var(--text-muted);
  border: 1px solid var(--border); margin-bottom: 8px;
}
.device-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.device-tag { font-family: var(--mono); font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.device-tag.port { background: rgba(20, 184, 166, 0.08); color: #14b8a6; border: 1px solid rgba(20, 184, 166, 0.15); }
.device-tag.issue { background: var(--destructive-muted); color: var(--destructive); border: 1px solid rgba(220, 38, 38, 0.15); font-weight: 600; }
.device-tag.warning-tag { background: var(--warning-muted); color: var(--warning); border: 1px solid rgba(217, 119, 6, 0.15); font-weight: 600; }
.device-customer-badge { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 4px; color: #fff; font-weight: 500; margin-bottom: 8px; }


.topology-container {
  width: 100%; height: calc(100vh - 160px); background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
  position: relative;
}
#topology-svg { display: block; }
.topology-tooltip {
  position: fixed; padding: 8px 12px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text); pointer-events: none; z-index: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.topology-tooltip .tt-ip { font-family: var(--mono); font-weight: 600; margin-bottom: 2px; }
.topology-tooltip .tt-host { color: var(--text-muted); }
.topology-tooltip .tt-issues { color: var(--destructive); margin-top: 2px; }


.agents-list { display: flex; flex-direction: column; gap: 8px; }
.agent-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px; transition: border-color 0.12s var(--ease);
}
.agent-card:hover { border-color: var(--border-hover); }
.agent-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.agent-dot.online { background: var(--success); }
.agent-dot.offline { background: var(--text-faint); }
.agent-card-info { flex: 1; min-width: 0; }
.agent-card-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.agent-card-meta { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 12px; }
.agent-card-meta span { display: flex; align-items: center; gap: 4px; }
.agent-card-customer { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 4px; color: #fff; font-weight: 500; }
.agent-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.agent-card-assign {
  padding: 5px 8px; font-size: 11px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary); font-family: var(--font); outline: none; cursor: pointer;
}
.agent-card-assign:hover { border-color: var(--border-hover); }
.agent-create-form {
  display: flex; gap: 8px; align-items: center; margin-bottom: 16px;
  padding: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.agent-key-banner {
  background: var(--success-muted);
  border: 1px solid rgba(22, 163, 74, 0.2); border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.agent-key-banner-title { font-size: 13px; font-weight: 600; color: var(--success); margin-bottom: 10px; }
.agent-key-banner-key { display: flex; align-items: center; gap: 8px; }
.agent-key-banner-key code {
  flex: 1; font-family: var(--mono); font-size: 12px; background: var(--bg-input);
  padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  word-break: break-all; color: var(--text);
}


.timeline-list { display: flex; flex-direction: column; }
.timeline-entry { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border-subtle); }
.timeline-entry:last-child { border-bottom: none; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.timeline-dot.has-issues { background: var(--warning); }
.timeline-info { flex: 1; min-width: 0; }
.timeline-agent { font-size: 13px; font-weight: 500; }
.timeline-details { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.timeline-time { font-family: var(--mono); font-size: 11px; color: var(--text-muted); white-space: nowrap; }


.customer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.customer-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer; transition: all 0.12s var(--ease); position: relative; overflow: hidden;
}
.customer-card:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.customer-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.customer-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.customer-card-name { font-size: 15px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.customer-card-contact { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.customer-card-contact .email { color: var(--text-faint); }
.customer-card-stats { display: flex; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.customer-card-stat { flex: 1; text-align: center; }
.customer-card-stat-val { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--text); }
.customer-card-stat-val.critical { color: var(--destructive); }
.customer-card-stat-val.warning { color: var(--warning); }
.customer-card-stat-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.customer-card-actions { position: absolute; top: 14px; right: 14px; display: flex; gap: 4px; opacity: 0; transition: opacity 0.12s var(--ease); }
.customer-card:hover .customer-card-actions { opacity: 1; }
.customer-card-actions .btn { padding: 3px 8px; font-size: 11px; }


.settings-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; max-width: 480px; }
.settings-body { padding: 20px; }


.detail-panel-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 400;
  opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease);
}
.detail-panel-backdrop.open { opacity: 1; pointer-events: auto; }

.detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px;
  background: var(--bg-card); border-left: 1px solid var(--border);
  z-index: 450; transform: translateX(100%); transition: transform 0.25s var(--ease);
  display: flex; flex-direction: column;
}
.detail-panel.open { transform: translateX(0); }
.detail-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.detail-panel-header h2 { font-size: 16px; font-weight: 600; }
.detail-panel-body { flex: 1; overflow-y: auto; padding: 22px; }


.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7); z-index: 500;
  align-items: center; justify-content: center; padding: 24px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 100%; max-width: 540px; max-height: 85vh; overflow-y: auto;
  animation: modal-in 0.2s var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 4px 8px; line-height: 1; border-radius: var(--radius-sm); transition: all 0.12s var(--ease); }
.modal-close:hover { color: var(--text); background: var(--bg-hover); }
.modal-body { padding: 22px; }


.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.detail-item { display: flex; flex-direction: column; gap: 3px; }
.detail-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.detail-value { font-family: var(--mono); font-size: 13px; color: var(--text); }
.detail-section-title {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

.port-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.port-table th {
  font-size: 11px; color: var(--text-muted); text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--border); font-weight: 600;
}
.port-table td { padding: 8px 10px; font-size: 12px; border-bottom: 1px solid var(--border-subtle); font-family: var(--mono); }
.port-table tr:last-child td { border-bottom: none; }
.port-table .port-num { color: var(--text); font-weight: 600; }
.port-table .port-service { color: var(--text-secondary); }
.port-table .port-state { color: var(--success); }

.issue-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 8px; border-left: 3px solid var(--border);
}
.issue-card.severity-critical, .issue-card.severity-high { border-left-color: var(--destructive); }
.issue-card.severity-medium { border-left-color: var(--warning); }
.issue-card.severity-low { border-left-color: var(--info); }
.issue-card.severity-info { border-left-color: var(--text-faint); }
.issue-severity { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; margin-bottom: 4px; }
.issue-severity.critical, .issue-severity.high { color: var(--destructive); }
.issue-severity.medium { color: var(--warning); }
.issue-severity.low { color: var(--info); }
.issue-severity.info { color: var(--text-muted); }
.issue-title { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.issue-desc { font-size: 12px; color: var(--text-muted); }


.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="color"] { width: 40px; height: 40px; border: none; background: none; cursor: pointer; padding: 0; border-radius: var(--radius-sm); }
.color-preview { width: 28px; height: 28px; border-radius: var(--radius-sm); background: #3b82f6; border: 1px solid var(--border); }


.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 600; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 18px; font-size: 13px; animation: toast-in 0.2s var(--ease);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.toast.success { border-color: rgba(22, 163, 74, 0.4); }
.toast.error { border-color: rgba(220, 38, 38, 0.4); }
.toast.removing { animation: toast-out 0.2s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(8px); } }


.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }
.stat-value.animated { animation: counter-up 0.3s var(--ease); }
@keyframes counter-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }


.sec-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.sec-summary-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; text-align: center; transition: border-color 0.12s var(--ease);
}
.sec-summary-card:hover { border-color: var(--border-hover); }
.sec-summary-val { font-family: var(--mono); font-size: 36px; font-weight: 700; line-height: 1; margin-bottom: 6px; }
.sec-critical .sec-summary-val { color: var(--destructive); }
.sec-warning .sec-summary-val { color: var(--warning); }
.sec-info .sec-summary-val { color: var(--info); }
.sec-summary-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.sec-risk-row {
  display: flex; align-items: center; gap: 20px; margin-bottom: 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px;
}
.sec-risk-gauge { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.sec-risk-gauge svg { width: 72px; height: 72px; transform: rotate(-90deg); }
.sec-risk-gauge-bg { fill: none; stroke: var(--border); stroke-width: 5; }
.sec-risk-gauge-fill { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.6s var(--ease), stroke 0.3s; }
.sec-risk-value { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 20px; font-weight: 700; }
.sec-risk-info { flex: 1; }
.sec-risk-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.sec-risk-desc { font-size: 12px; color: var(--text-muted); }

.sec-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-filters { display: flex; gap: 4px; }
.sec-filter-btn {
  padding: 6px 14px; font-size: 12px; font-family: var(--font); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-muted); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.12s var(--ease); font-weight: 500;
}
.sec-filter-btn:hover { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text-secondary); }
.sec-filter-btn.active { background: var(--bg-surface); border-color: var(--text-muted); color: var(--text); }

.sec-issues { display: flex; flex-direction: column; gap: 8px; }
.sec-issue-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; border-left: 3px solid var(--border); transition: all 0.12s var(--ease);
}
.sec-issue-card:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.sec-issue-card.sev-critical { border-left-color: var(--destructive); }
.sec-issue-card.sev-warning { border-left-color: var(--warning); }
.sec-issue-card.sev-info { border-left-color: var(--info); }
.sec-issue-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sec-sev-badge {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 700; padding: 3px 8px; border-radius: 4px; flex-shrink: 0;
}
.sec-sev-badge.sev-critical { background: var(--destructive-muted); color: var(--destructive); }
.sec-sev-badge.sev-warning { background: var(--warning-muted); color: var(--warning); }
.sec-sev-badge.sev-info { background: var(--info-muted); color: var(--info); }
.sec-issue-title { font-size: 14px; font-weight: 600; flex: 1; }
.sec-issue-device { font-family: var(--mono); font-size: 11px; color: var(--text-muted); cursor: pointer; transition: color 0.12s var(--ease); }
.sec-issue-device:hover { color: var(--text); }
.sec-issue-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; line-height: 1.6; }
.sec-issue-meta { display: flex; gap: 12px; font-family: var(--mono); font-size: 11px; color: var(--text-faint); margin-bottom: 8px; }
.sec-issue-recommendation {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12px; color: var(--text-muted); line-height: 1.6;
}
.sec-group-header {
  font-size: 13px; font-weight: 600; padding: 12px 0 6px; border-bottom: 1px solid var(--border);
  margin-bottom: 8px; display: flex; align-items: center; gap: 10px; color: var(--text-secondary);
}
.sec-group-header .sec-group-ip { font-family: var(--mono); color: var(--text); cursor: pointer; transition: color 0.12s var(--ease); }
.sec-group-header .sec-group-ip:hover { color: var(--text-secondary); }
.sec-group-header .sec-group-count {
  font-family: var(--mono); font-size: 10px; padding: 2px 6px; border-radius: 20px;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-muted); font-weight: 500;
}


.ov-sec-top-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border-subtle); transition: background 0.12s var(--ease); cursor: pointer; }
.ov-sec-top-item:last-child { border-bottom: none; }
.ov-sec-top-item:hover { background: var(--bg-hover); }
.ov-sec-top-sev { width: 3px; height: 24px; border-radius: 2px; flex-shrink: 0; background: var(--destructive); }
.ov-sec-top-info { flex: 1; min-width: 0; }
.ov-sec-top-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-sec-top-meta { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-top: 2px; }


@media (max-width: 1400px) {
  .overview-grid { grid-template-columns: repeat(2, 1fr); }
  .ov-security-panel, .ov-timeline-panel { grid-column: span 2; }
}
@media (max-width: 1100px) {
  .stats-bar { grid-template-columns: repeat(3, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .ov-security-panel, .ov-timeline-panel { grid-column: span 1; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .dashboard-main { margin-left: 0 !important; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .device-grid { grid-template-columns: 1fr; }
  .customer-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .sec-summary { grid-template-columns: 1fr; }
  .header { padding: 0 14px; }
  .main-content { padding: 14px; }
  .detail-panel { width: 100%; }
  .notification-dropdown { width: 300px; right: -40px; }
}
