/* ================================================================
   Corgi Web Console - IoT Remote O&M Design System
   Pure Vanilla CSS (Zero Build / No Bundler Required)
   ================================================================ */

:root {
  --topbar-h: 48px;
  --sidebar-w: 250px;

  /* Color Palette - Enterprise Dark Theme */
  --bg-app: #080c14;
  --bg-main: #0b101b;
  --bg-topbar: #0e1524;
  --bg-sidebar: #090e18;
  --bg-card: #111827;
  --bg-card-hover: #151f32;
  --bg-input: rgba(15, 23, 42, 0.7);

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-focus: #3b82f6;

  --fg-primary: #f1f5f9;
  --fg-secondary: #94a3b8;
  --fg-muted: #64748b;

  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.25);

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.3);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, "Liberation Mono", monospace;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 13px;
  background-color: var(--bg-app);
  color: var(--fg-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================
   Typography & Basic Components
   ========================================== */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

code, .code-id {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  color: #7ee787;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.icon {
  width: 15px;
  height: 15px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  padding: 0.38rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 4px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #ffffff;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg-primary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.11);
  border-color: var(--border-medium);
  color: #fff;
}

.btn-sm {
  padding: 0.25rem 0.55rem;
  font-size: 11.5px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 3px 5px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  transition: all 0.15s ease;
}
.btn-icon:hover {
  color: var(--fg-primary);
  background: rgba(255, 255, 255, 0.08);
}

.btn-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-close:hover {
  color: var(--fg-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.copied {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

/* ==========================================
   Global Topbar (48px Enterprise Header)
   ========================================== */
.topbar {
  height: var(--topbar-h);
  padding: 0 1rem;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 100;
  user-select: none;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-sidebar-toggle {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-secondary);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.btn-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg-primary);
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-primary);
  letter-spacing: -0.2px;
}
.brand-logo {
  font-size: 16px;
}
.brand:hover {
  color: var(--fg-primary);
}

.fleet-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 999px;
  color: #34d399;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-indicator-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--fg-secondary);
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-secondary);
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

/* ==========================================
   App Shell Layout (Dual-Pane)
   ========================================== */
.app-layout {
  display: flex;
  height: calc(100vh - var(--topbar-h));
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* ==========================================
   Left Sidebar
   ========================================== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 90;
  user-select: none;
}

.sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  border-right: none !important;
  overflow: hidden !important;
}

.sidebar-header {
  padding: 0.75rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-primary);
  text-decoration: none;
  flex: 1;
}
.sidebar-nav-item.active {
  color: var(--accent);
}

.sidebar-search-box {
  padding: 0.6rem 0.85rem 0.4rem 0.85rem;
  position: relative;
  display: flex;
  align-items: center;
}
.sidebar-search-box .icon {
  position: absolute;
  left: 18px;
  color: var(--fg-muted);
  pointer-events: none;
}
.sidebar-filter-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem 0.3rem 24px;
  font-size: 11.5px;
  color: var(--fg-primary);
  outline: none;
}
.sidebar-filter-input:focus {
  border-color: var(--border-focus);
}

.sidebar-section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  padding: 0.8rem 0.85rem 0.35rem 0.85rem;
}

.sidebar-device-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 0.5rem;
  flex: 1;
  overflow-y: auto;
}

.device-tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--fg-secondary);
  text-decoration: none;
  transition: all 0.12s ease;
  position: relative;
  border-left: 3px solid transparent;
}
.device-tree-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg-primary);
}
.device-tree-item.active {
  background: rgba(59, 130, 246, 0.12);
  color: #fff;
  border-left-color: var(--accent);
  font-weight: 600;
}

.device-tree-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-tree-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg-muted);
  padding: 1px 4px;
  border-radius: 3px;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-empty {
  padding: 1rem 0.5rem;
  text-align: center;
  font-size: 11.5px;
  color: var(--fg-muted);
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 0.85rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--fg-muted);
}
.latency-dot {
  color: var(--success);
}

.sidebar-backdrop {
  display: none;
}

/* ==========================================
   Main Content Workspace
   ========================================== */
.main-content {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-main);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ==========================================
   Workspace Header & Tabs
   ========================================== */
.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-muted);
}
.breadcrumb-item {
  color: var(--fg-secondary);
}
.breadcrumb-item.active {
  color: var(--fg-primary);
  font-weight: 600;
}
.breadcrumb-sep {
  color: var(--fg-muted);
  opacity: 0.5;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 3px;
  border-radius: var(--radius-md);
  width: fit-content;
}

.workspace-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}
.workspace-tab:hover {
  color: var(--fg-primary);
  background: rgba(255, 255, 255, 0.05);
}
.workspace-tab.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 4px var(--accent-glow);
}

/* ==========================================
   IoT Fleet Summary Cards
   ========================================== */
.fleet-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.fleet-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s ease;
}
.fleet-stat-card:hover {
  border-color: var(--border-medium);
}

.stat-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.stat-icon-wrap.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}
.stat-icon-wrap.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}
.stat-icon-wrap.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}
.stat-icon-wrap.purple {
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
}

.stat-info {
  display: flex;
  flex-direction: column;
}
.stat-label {
  font-size: 11.5px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg-primary);
  line-height: 1.2;
}

/* ==========================================
   Toolbar & Search Filter Cards
   ========================================== */
.toolbar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
}
.search-input {
  padding-left: 32px !important;
}

.filter-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================
   Cards & Content Containers
   ========================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table-card {
  margin-bottom: 1.5rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.device-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.device-table th {
  padding: 0.7rem 0.9rem;
  background: rgba(0, 0, 0, 0.25);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.device-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
  vertical-align: middle;
}

.device-table tbody tr {
  transition: background 0.12s ease;
}
.device-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.node-title-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.node-name {
  font-weight: 600;
  color: var(--fg-primary);
}

/* Status Indicators */
.status-indicator {
  display: inline-flex;
  align-items: center;
}
.status-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-indicator.online .dot {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.status-indicator.offline .dot {
  background: var(--fg-muted);
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
}
.badge-pill {
  border-radius: 999px;
}
.badge-primary {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}

.badge-ip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: #7ee787;
  user-select: text;
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.2);
}
.tag-group {
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border-color: rgba(216, 180, 254, 0.25);
}

/* ==========================================
   Device Detail Page & Metric Widgets
   ========================================== */
.device-detail-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.host-specs-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

.host-specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem 1.25rem;
}

.host-spec-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.host-spec-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
}
.host-spec-val {
  font-size: 13px;
  color: var(--fg-primary);
  font-weight: 500;
}

.host-ips-row {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 4px;
  text-align: left;
}

/* Metric Gauges Grid */
.monitor-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1rem;
}

.monitor-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
}

.metric-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.metric-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-primary);
}

.stat-main-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.stat-number-huge {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--fg-primary);
  line-height: 1;
}

.stat-subtext {
  font-size: 12px;
  color: var(--fg-muted);
}

/* Progress Track & Fill */
.progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
}
.fill-success { background: var(--success); }
.fill-warning { background: var(--warning); }
.fill-danger  { background: var(--danger); }

/* Load average chips */
.load-avg-chips {
  display: flex;
  gap: 4px;
}
.load-chip {
  font-size: 11px;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--fg-secondary);
}

/* CPU Core breakdown */
.cpu-cores-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}
.cpu-cores-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--fg-muted);
  font-weight: 600;
  text-transform: uppercase;
}
.cpu-cores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 6px;
}
.core-chip {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.core-chip-title {
  display: flex;
  justify-content: space-between;
  color: var(--fg-muted);
  font-size: 10px;
}

/* Memory & Swap Blocks */
.mem-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mem-block-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.mem-stat-chips {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  color: var(--fg-secondary);
  font-family: var(--font-mono);
}

/* Canvas Sparkline & Charts */
.chart-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chart-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
}
.chart-legend {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--fg-muted);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.chart-wrapper {
  position: relative;
  width: 100%;
  height: 140px;
}
.metric-chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Chart Tooltip */
.chart-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-size: 11px;
  color: var(--fg-primary);
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.chart-tooltip .tooltip-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-muted);
  margin-bottom: 3px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 2px;
}
.chart-tooltip .tooltip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chart-tooltip .tooltip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* ==========================================
   Dedicated Storage & Network Tables
   ========================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.data-table th {
  padding: 0.65rem 0.85rem;
  background: rgba(0, 0, 0, 0.25);
  color: var(--fg-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}
.data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

/* ==========================================
   Terminal View
   ========================================== */
.device-detail-page.terminal-active {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.device-detail-page.terminal-active #device-tab-body {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.terminal-fullscreen-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 300px;
  height: 100%;
  width: 100%;
  background: #080c14;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.terminal-topbar {
  padding: 0.45rem 1rem;
  background: #0f1624;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.terminal-body {
  position: absolute;
  inset: 0;
  padding: 8px 12px;
  background: #080c14;
  overflow: hidden;
}

.terminal-body .xterm {
  height: 100%;
  width: 100%;
}

.terminal-body .xterm-viewport {
  overflow-y: auto !important;
}

/* ==========================================
   Pulse Animations & Status Badges
   ========================================== */
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--success);
  display: inline-block;
  position: relative;
}
.pulse-dot::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background-color: var(--success);
  opacity: 0.6;
  animation: pulse-ring 1.8s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}
.status-badge.connecting {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.status-badge.connected {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-badge.closed, .status-badge.error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-group {
  display: inline-flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  padding: 2px;
  border-radius: var(--radius-sm);
}

/* ==========================================
   Sign In Page
   ========================================== */
.signin-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  width: 100%;
}
.signin-card {
  max-width: 400px;
  width: 100%;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.signin-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}
.signin-brand .logo-badge {
  font-size: 36px;
  margin-bottom: 0.5rem;
}
.signin-brand h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--fg-primary);
}
.signin-brand .subtitle {
  font-size: 12.5px;
  color: var(--fg-muted);
  margin-top: 4px;
}
.signin-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-primary);
}
.form-input, .form-select {
  background: var(--bg-input);
  color: var(--fg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
  width: 100%;
}
.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Alerts & Spinners */
.alert {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-card {
  background: #131a29;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}
.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.code-block {
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.code-block code, .code-block pre {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #7ee787;
  overflow-x: auto;
  background: none;
  border: none;
  padding: 0;
}

/* Utilities */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.font-medium { font-weight: 500; }
.text-right { text-align: right; }
.text-muted { color: var(--fg-muted); }

/* Responsive adjustments */
@media (max-width: 960px) {
  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.7);
    transform: translateX(0);
  }
  .sidebar.collapsed {
    transform: translateX(-100%) !important;
    width: var(--sidebar-w) !important;
    min-width: var(--sidebar-w) !important;
  }
  .sidebar-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .sidebar:not(.collapsed) ~ .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .topbar-center {
    display: none;
  }
  .monitor-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   Monitor & Table Utility Classes
   ========================================== */
.cell-mono {
  font-family: var(--font-mono);
}
.cell-strong {
  font-weight: 600;
  color: var(--fg-primary);
}
.cell-muted {
  color: var(--fg-muted);
}
.cell-secondary {
  color: var(--fg-secondary);
}
.cell-success {
  color: var(--success);
}
.cell-rx {
  color: #10b981;
}
.cell-tx {
  color: #38bdf8;
}
.cell-usage {
  min-width: 120px;
}
.usage-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.usage-pct {
  font-size: 11.5px;
  font-family: var(--font-mono);
}
.empty-hint {
  padding: 1.5rem 0;
  text-align: center;
}
.core-track {
  height: 3px;
}
.tag-plain {
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg-secondary);
}
