/* ============================================================
   DRISHTI PRO — Design System v2.0
   Dark Glassmorphism + Neon Green Monitoring Tool
   ============================================================ */

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

/* ---- TOKENS ---- */
:root {
  /* Colors */
  --bg-void:      #050507;
  --bg-base:      #080810;
  --bg-surface:   #0d0d1a;
  --bg-raise:     #121224;
  --bg-glass:     rgba(255,255,255,0.03);
  --bg-glass-hov: rgba(255,255,255,0.06);

  --border:       rgba(255,255,255,0.07);
  --border-focus: rgba(0,255,136,0.4);

  --brand:        #00ff88;
  --brand-dim:    rgba(0,255,136,0.12);
  --brand-glow:   0 0 20px rgba(0,255,136,0.25);

  --red:          #ff4d4f;
  --red-dim:      rgba(255,77,79,0.15);
  --yellow:       #ffd500;
  --yellow-dim:   rgba(255,213,0,0.12);
  --blue:         #2997ff;
  --blue-dim:     rgba(41,151,255,0.12);
  --purple:       #bf5af2;

  --text-1:       #f0f0f8;
  --text-2:       #8888a8;
  --text-3:       #444466;

  /* Radii */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-pill: 999px;

  /* Sidebar */
  --sidebar-w: 64px;
  --header-h:  58px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-void);
  color: var(--text-1);
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   APP SHELL — Sidebar + Header + Main
   ============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-base);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 4px;
  flex-shrink: 0;
  z-index: 50;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: var(--brand-dim);
  border: 1px solid var(--brand);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: var(--brand-glow);
}

.sidebar-logo svg { color: var(--brand); width: 20px; height: 20px; }

.sidebar-divider {
  width: 32px;
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.nav-item {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
  border: 1px solid transparent;
  color: var(--text-3);
  background: transparent;
}

.nav-item:hover {
  background: var(--bg-glass-hov);
  color: var(--text-2);
  border-color: var(--border);
}

.nav-item.active {
  background: var(--brand-dim);
  border-color: rgba(0,255,136,0.25);
  color: var(--brand);
  box-shadow: var(--brand-glow);
}

.nav-item svg { width: 18px; height: 18px; }

/* Tooltip */
.nav-item::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-raise);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 200;
}

.nav-item:hover::after { opacity: 1; }

.sidebar-spacer { flex: 1; }

/* ---- Main wrapper ---- */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ---- Header ---- */
.app-header {
  height: var(--header-h);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-brand-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.02em;
}

.header-brand-name span { color: var(--brand); }

.header-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-dim);
  border: 1px solid rgba(0,255,136,0.2);
  padding: 2px 7px;
  border-radius: var(--r-pill);
}

.header-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-sep { color: var(--text-3); }
.header-section-title strong { color: var(--text-1); }

.header-spacer { flex: 1; }

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.04em;
}

.header-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 8px var(--brand);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.header-btn:hover { background: var(--bg-glass-hov); color: var(--text-1); border-color: rgba(255,255,255,0.12); }
.header-btn.primary { background: var(--brand-dim); border-color: rgba(0,255,136,0.3); color: var(--brand); }
.header-btn.primary:hover { background: rgba(0,255,136,0.2); box-shadow: var(--brand-glow); }
.header-btn svg { width: 14px; height: 14px; }

/* ---- Content area ---- */
.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.content-area::-webkit-scrollbar { width: 5px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb { background: var(--bg-raise); border-radius: 10px; }

/* ---- Views ---- */
.view { display: none; height: 100%; }
.view.active { display: flex; flex-direction: column; height: 100%; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* Stat Cards */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.stat-card {
  background: var(--bg-base);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: background 0.2s var(--ease);
}

.stat-card:hover { background: var(--bg-surface); }

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 18px; height: 18px; }
.stat-icon.green  { background: var(--brand-dim); color: var(--brand); }
.stat-icon.red    { background: var(--red-dim);   color: var(--red); }
.stat-icon.yellow { background: var(--yellow-dim); color: var(--yellow); }
.stat-icon.blue   { background: var(--blue-dim);  color: var(--blue); }

.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--text-1); line-height: 1; letter-spacing: -0.03em; }
.stat-label { font-size: 10px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 3px; }

/* Cards */
.card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: all 0.2s var(--ease);
}

.card:hover { background: var(--bg-glass-hov); border-color: rgba(255,255,255,0.1); }

/* Asset cards */
.asset-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  position: relative;
  transition: all 0.2s var(--ease);
}

.asset-card:hover {
  border-color: rgba(255,255,255,0.1);
  background: var(--bg-raise);
}

.asset-card .delete-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s;
}

.asset-card:hover .delete-btn { opacity: 1; }
.asset-card .delete-btn:hover { background: var(--red-dim); color: var(--red); }
.asset-card .delete-btn svg { width: 12px; height: 12px; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.status-online { background: rgba(0,255,136,0.1); color: var(--brand); }
.status-online::before { background: var(--brand); box-shadow: 0 0 6px var(--brand); }

.status-offline { background: rgba(255,77,79,0.1); color: var(--red); }
.status-offline::before { background: var(--red); }

.status-degraded { background: rgba(255,213,0,0.1); color: var(--yellow); }
.status-degraded::before { background: var(--yellow); }

.status-checking { background: rgba(136,136,168,0.1); color: var(--text-2); }
.status-checking::before { background: var(--text-2); animation: pulse-dot 1s infinite; }

.status-healthy  { background: rgba(0,255,136,0.1); color: var(--brand); }
.status-healthy::before { background: var(--brand); box-shadow: 0 0 6px var(--brand); }

/* Metric row in asset cards */
.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.metric-row:last-child { border-bottom: none; }
.metric-key { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.metric-val { font-size: 10px; font-weight: 600; font-family: 'JetBrains Mono', monospace; color: var(--text-2); }

/* Section headers */
.section-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

.section-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-dim);
  padding: 2px 7px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(0,255,136,0.15);
}

/* Grid layouts */
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 16px;
  padding: 0 24px 24px;
}

/* Tabs */
.monitor-tabs {
  display: flex;
  gap: 2px;
  padding: 16px 24px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.monitor-tabs::-webkit-scrollbar { display: none; }

.mtab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-md) var(--r-md) 0 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
  background: transparent;
  position: relative;
  bottom: -1px;
}

.mtab:hover { color: var(--text-2); background: var(--bg-glass); }

.mtab.active {
  color: var(--brand);
  background: var(--bg-base);
  border-color: var(--border);
  border-bottom-color: var(--bg-base);
}

.mtab-count {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--r-pill);
  background: var(--bg-raise);
  color: var(--text-3);
}

.mtab.active .mtab-count { background: var(--brand-dim); color: var(--brand); }

.monitor-panel { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.monitor-panel.active { display: flex; }

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--text-3);
}

.empty-state svg { width: 48px; height: 48px; opacity: 0.3; }
.empty-state p { font-size: 13px; }
.empty-state .add-link { color: var(--brand); font-size: 12px; font-weight: 600; cursor: pointer; }
.empty-state .add-link:hover { text-decoration: underline; }

/* Terminal View */
.terminal-view {
  display: flex;
  gap: 12px;
  padding: 16px;
  height: 100%;
  overflow: hidden;
}

.server-list-panel {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.server-list-panel::-webkit-scrollbar { width: 3px; }
.server-list-panel::-webkit-scrollbar-thumb { background: var(--bg-raise); }

.server-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
}

.server-item:hover { background: var(--bg-raise); border-color: rgba(255,255,255,0.1); }
.server-item.active-server { border-color: rgba(0,255,136,0.3); background: var(--brand-dim); }

.server-item-name { font-size: 12px; font-weight: 600; color: var(--text-1); }
.server-item-host { font-size: 10px; color: var(--text-3); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }
.server-item-status { display: flex; align-items: center; gap: 5px; margin-top: 6px; }

.server-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s;
}

.server-item:hover .server-delete { opacity: 1; }
.server-delete:hover { background: var(--red-dim); color: var(--red); }
.server-delete svg { width: 10px; height: 10px; }

.terminal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #020204;
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
}

.terminal-dots { display: flex; gap: 6px; }
.terminal-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.terminal-dot.red    { background: #ff5f57; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green  { background: #28c840; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
}

.terminal-actions { display: flex; gap: 6px; }

.term-action-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.term-action-btn:hover { background: var(--bg-glass); color: var(--text-1); }
.term-action-btn svg { width: 12px; height: 12px; }

#terminal-container {
  flex: 1;
  overflow: hidden;
  padding: 4px;
}

/* Network Tools */
.network-tools-view {
  display: flex;
  gap: 0;
  height: 100%;
  overflow: hidden;
}

.tools-sidebar {
  width: 200px;
  border-right: 1px solid var(--border);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.tool-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.tool-item:hover { background: var(--bg-glass); color: var(--text-1); }
.tool-item.active { color: var(--brand); border-left-color: var(--brand); background: var(--brand-dim); }
.tool-item svg { width: 14px; height: 14px; }

.tool-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
  gap: 16px;
}

/* Inputs */
.ds-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s;
}

.ds-input:focus { border-color: var(--border-focus); }
.ds-input::placeholder { color: var(--text-3); }

.ds-select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 12px;
  padding: 10px 14px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23444466' stroke-width='2'%3E%3Cpath d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px;
}

.ds-select:focus { border-color: var(--border-focus); }

.ds-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 6px;
}

/* Buttons */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}

.ds-btn svg { width: 13px; height: 13px; }
.ds-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.ds-btn-primary {
  background: var(--brand);
  color: #000;
  border-color: var(--brand);
}
.ds-btn-primary:hover:not(:disabled) { filter: brightness(1.15); box-shadow: var(--brand-glow); }

.ds-btn-ghost {
  background: var(--bg-glass);
  color: var(--text-2);
  border-color: var(--border);
}
.ds-btn-ghost:hover:not(:disabled) { background: var(--bg-glass-hov); color: var(--text-1); border-color: rgba(255,255,255,0.12); }

.ds-btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(255,77,79,0.25);
}
.ds-btn-danger:hover:not(:disabled) { background: rgba(255,77,79,0.25); }

.ds-btn-full { width: 100%; }

/* Output box */
.output-box {
  background: var(--bg-void);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.7;
  color: var(--brand);
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 100px;
  max-height: 300px;
  overflow-y: auto;
  flex: 1;
}

.output-box::-webkit-scrollbar { width: 3px; }
.output-box::-webkit-scrollbar-thumb { background: var(--bg-raise); }

/* Monitoring metrics */
.mini-gauge-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.mini-gauge {
  flex: 1;
  background: var(--bg-void);
  border-radius: var(--r-sm);
  padding: 8px;
}

.mini-gauge-label { font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 4px; }
.mini-gauge-val { font-size: 14px; font-weight: 800; color: var(--text-1); font-family: 'JetBrains Mono', monospace; line-height: 1; }
.mini-gauge-bar { height: 3px; background: var(--bg-raise); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.mini-gauge-fill { height: 100%; border-radius: 2px; transition: width 0.5s var(--ease); }
.mini-gauge-fill.green  { background: var(--brand); }
.mini-gauge-fill.yellow { background: var(--yellow); }
.mini-gauge-fill.red    { background: var(--red); }

/* Monitoring server card */
.monitor-server-card {
  position: relative; /* Essential for absolute delete btn */
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: all 0.2s var(--ease);
}

.monitor-server-card:hover { border-color: rgba(255,255,255,0.1); }

.monitor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: rgba(255,255,255,0.02);
}

.monitor-card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0; /* Critical for truncation */
  flex: 1;
}

.monitor-card-title-group div {
  min-width: 0;
  overflow: hidden;
}

.monitor-card-title-group p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Delete / stop-monitoring button - now absolute to avoid layout issues */
.monitor-del-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.05);
  background: var(--bg-raise);
  color: var(--text-3);
  font-size: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}
.monitor-del-btn:hover {
  background: var(--red-dim);
  border-color: var(--red);
  color: #fff;
  transform: rotate(90deg);
}

.monitor-card-body { padding: 14px 16px; }

.monitor-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

/* Metrics Matrix Table */
.metrics-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 4px;
}
.metrics-matrix thead th {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 8px 4px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}

.metrics-matrix tbody tr td {
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  font-family: 'JetBrains Mono', monospace;
}
.metrics-matrix tbody tr:last-child td { border-bottom: none; }
.metrics-matrix tbody tr td:not(:first-child) { text-align: right; }

.metric-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  font-family: inherit !important;
}
.metric-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cpu-dot  { background: var(--brand); box-shadow: 0 0 4px var(--brand); }
.ram-dot  { background: #5ac8fa; box-shadow: 0 0 4px #5ac8fa44; }
.disk-dot { background: var(--yellow); box-shadow: 0 0 4px #ffd50044; }

.metric-val-live {
  font-size: 13px !important;
  font-weight: 800;
  color: var(--text-1) !important;
}
.gauge-row td { padding: 2px 0 8px 0 !important; }

.supp-metrics {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}



.monitor-metric-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.monitor-metric-val   { font-size: 10px; font-weight: 600; color: var(--text-2); font-family: 'JetBrains Mono', monospace; }

/* Modal */
.ds-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 500;
}

.ds-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%;
  padding: 32px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.8);
  animation: modal-in 0.25s var(--ease);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

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

.ds-modal-title { font-size: 16px; font-weight: 700; color: var(--text-1); }
.ds-modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.ds-modal-close:hover { background: var(--bg-glass-hov); color: var(--text-1); }
.ds-modal-close svg { width: 14px; height: 14px; }

.ds-form-group { margin-bottom: 16px; }
.ds-modal-footer { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Troubleshoot Modal */
.trbl-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.trbl-step:last-child { border-bottom: none; }

.trbl-step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  margin-top: 1px;
}

.trbl-step-icon.pass   { background: rgba(0,255,136,0.1); color: var(--brand); }
.trbl-step-icon.fail   { background: rgba(255,77,79,0.1);  color: var(--red); }
.trbl-step-icon.running { background: rgba(255,213,0,0.1); color: var(--yellow); animation: pulse-dot 0.8s infinite; }

.trbl-step-label { font-size: 12px; font-weight: 600; color: var(--text-1); }
.trbl-step-detail { font-size: 10px; color: var(--text-2); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }

.health-ring-wrap { position: relative; width: 80px; height: 80px; }
.health-ring-wrap svg { width: 80px; height: 80px; transform: rotate(-90deg); }
.health-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.health-score-num { font-size: 20px; font-weight: 800; color: var(--text-1); line-height: 1; }
.health-score-lbl { font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }

.suggestion-card {
  background: var(--bg-raise);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  gap: 12px;
}

.suggestion-card.critical { border-color: rgba(255,77,79,0.2); background: rgba(255,77,79,0.04); }
.suggestion-card.warning  { border-color: rgba(255,213,0,0.2); background: rgba(255,213,0,0.04); }
.suggestion-card.action   { border-color: rgba(0,255,136,0.2); background: rgba(0,255,136,0.04); }

.suggestion-title { font-size: 12px; font-weight: 700; color: var(--text-1); margin-bottom: 4px; }
.suggestion-detail { font-size: 10px; color: var(--text-2); line-height: 1.6; }
.suggestion-detail pre { background: var(--bg-void); padding: 10px; border-radius: var(--r-sm); margin-top: 8px; font-size: 10px; white-space: pre-wrap; color: var(--brand); }

/* Alert banner */
.alert-trbl-btn {
  margin-top: 10px;
  width: 100%;
  padding: 8px;
  background: rgba(255,213,0,0.06);
  border: 1px solid rgba(255,213,0,0.2);
  border-radius: var(--r-md);
  color: var(--yellow);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s var(--ease);
}

.alert-trbl-btn:hover { background: rgba(255,213,0,0.12); }
.alert-trbl-btn svg { width: 12px; height: 12px; }

/* Progress bar */
.progress { height: 4px; background: var(--bg-raise); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 2px; transition: width 0.5s var(--ease); }

/* Ping/Traceroute output */
.ping-result-line { color: var(--brand); font-family: 'JetBrains Mono', monospace; font-size: 11px; line-height: 1.6; }
.ping-result-line.err { color: var(--red); }
.ping-result-line.info { color: var(--blue); }

/* Scrollable content sections */
.scrollable { overflow-y: auto; flex: 1; }
.scrollable::-webkit-scrollbar { width: 4px; }
.scrollable::-webkit-scrollbar-thumb { background: var(--bg-raise); border-radius: 10px; }

/* Delete confirm modal */
.delete-confirm {
  text-align: center;
}

.delete-confirm-icon {
  width: 52px;
  height: 52px;
  background: var(--red-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--red);
}
.delete-confirm-icon svg { width: 24px; height: 24px; }
.delete-confirm h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.delete-confirm p  { font-size: 12px; color: var(--text-2); margin-bottom: 24px; }

/* Animations */
@keyframes fade-in {
  from { opacity:0; transform: translateY(6px); }
  to   { opacity:1; transform: translateY(0); }
}

.animate-in { animation: fade-in 0.25s var(--ease) forwards; }

/* Conn status colors in status-${status} pattern */
.status-online   { background: rgba(0,255,136,.1); color: var(--brand); }
.status-offline  { background: rgba(255,77,79,.1); color: var(--red); }
.status-degraded { background: rgba(255,213,0,.1); color: var(--yellow); }
.status-healthy  { background: rgba(0,255,136,.1); color: var(--brand); }
.status-checking { background: rgba(136,136,168,.1); color: var(--text-2); }
.status-error    { background: rgba(255,77,79,.1); color: var(--red); }
.status-timeout  { background: rgba(255,77,79,.1); color: var(--red); }
.status-unreachable { background: rgba(255,77,79,.1); color: var(--red); }
.status-open     { background: rgba(0,255,136,.1); color: var(--brand); }
.status-closed   { background: rgba(255,77,79,.1); color: var(--red); }

/* Dot colors */
.dot-green   { background: var(--brand); box-shadow: 0 0 6px var(--brand); }
.dot-red     { background: var(--red); }
.dot-yellow  { background: var(--yellow); }
.dot-gray    { background: var(--text-3); }

/* Hidden */
.hidden { display: none !important; }

/* Text utilities */
.text-brand  { color: var(--brand); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-2      { color: var(--text-2); }
.text-3      { color: var(--text-3); }
.mono        { font-family: 'JetBrains Mono', monospace; }
.fw-800      { font-weight: 800; }
.fs-11       { font-size: 11px; }
.fs-12       { font-size: 12px; }
.fs-13       { font-size: 13px; }

/* Scrollbar global */
* { scrollbar-width: thin; scrollbar-color: var(--bg-raise) transparent; }

/* 
   ============================================================
   SETTINGS & TOGGLE STYLES
   ============================================================ 
*/
.view-header {
  padding: 32px 32px 0;
  margin-bottom: 24px;
}
.view-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-1);
}
.view-subtitle {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}

/* Custom Toggle Switch */
.ds-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}
.ds-switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.ds-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-raise);
  transition: .2s;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.ds-slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-3);
  transition: .2s;
  border-radius: 50%;
}
input:checked + .ds-slider {
  background-color: var(--brand-dim);
  border-color: rgba(0,255,136,0.3);
}
input:checked + .ds-slider:before {
  transform: translateX(14px);
  background-color: var(--brand);
  box-shadow: 0 0 6px var(--brand);
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

/* Log Intelligence Styles */
.source-item {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}
.source-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--border);
}
.source-item.active {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--brand);
    box-shadow: inset 0 0 10px rgba(0,255,136,0.05);
}
.source-item span {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-2);
}
.log-line {
    border-bottom: 1px solid rgba(255,255,255,0.03);
    padding: 2px 0;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: var(--font-mono);
}
.log-line.error { color: #ff4d4f; background: rgba(255,77,79,0.05); }
.log-line.warn  { color: #faad14; }
.log-line.info  { color: #1890ff; }
.log-line.highlight { color: #fff; background: rgba(0,255,136,0.15); border-left: 2px solid var(--brand); padding-left: 6px; }

.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.05em;
    display: inline-block;
}

.log-alert-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: slideInRight 0.3s ease;
}
.log-alert-item:hover { background: rgba(255,255,255,0.02); }

@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.footer-link {
    font-size: 9px;
    color: var(--text-3);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-link:hover {
    color: var(--brand);
    text-shadow: 0 0 8px var(--brand);
}

.policy-pill {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 9px;
    color: var(--text-3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.policy-pill b {
    color: var(--text-1);
    font-weight: 800;
}
