:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1f2937;
  --bg-input: #374151;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --border: #374151;
  --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Login Page */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px var(--shadow);
}

.login-box h1 {
  text-align: center;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.login-box .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-brand h2 {
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

.sidebar-brand .version {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.sidebar-nav li a {
  display: block;
  padding: 0.5rem 1.5rem 0.5rem 2.25rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  transition: all 0.15s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  color: var(--text-primary);
  background: var(--bg-card);
  text-decoration: none;
}

.sidebar-nav li a.active {
  border-left: 3px solid var(--accent);
  padding-left: calc(2.25rem - 3px);
}

.sidebar-section {
  padding: 0.75rem 1.5rem 0.375rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: color 0.15s;
}

.sidebar-section:hover {
  color: var(--text-secondary);
}

.sidebar-section:not(.no-collapse)::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  transition: transform 0.2s;
}

.sidebar-section.collapsed::after {
  transform: rotate(-90deg);
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.sidebar-nav.collapsed {
  max-height: 0;
}

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.stat-card .label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.btn-danger-outline {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger-outline:hover {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
}

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
}

.badge-purple {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.badge-muted {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  min-width: 280px;
  max-width: 420px;
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease forwards;
  cursor: pointer;
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

.toast-error {
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
  border: 1px solid rgba(239, 68, 68, 0.6);
}

.toast-success {
  background: rgba(16, 185, 129, 0.95);
  color: #fff;
  border: 1px solid rgba(16, 185, 129, 0.6);
}

.toast-info {
  background: rgba(59, 130, 246, 0.95);
  color: #fff;
  border: 1px solid rgba(59, 130, 246, 0.6);
}

.toast-warning {
  background: rgba(245, 158, 11, 0.95);
  color: #fff;
  border: 1px solid rgba(245, 158, 11, 0.6);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 8px 32px var(--shadow);
}

.modal h2 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Pagination */
.pagination {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}

.pagination .info {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0 1rem;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toggle Switch */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  user-select: none;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--bg-input);
  border-radius: 10px;
  transition: background 0.2s;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::after {
  left: 18px;
  background: #fff;
}

/* Utility */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }

/* Help Tooltips — global, usable on any config page */
.help-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  line-height: 16px;
  cursor: help;
  margin-left: 0.25rem;
  vertical-align: middle;
  position: relative;
}
/* Widget Grid (Dashboard) — 6-column layout */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.widget-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  grid-column: span 2; /* default: third */
  transition: box-shadow 0.15s, opacity 0.15s;
  position: relative;
}

.widget-card.size-full {
  grid-column: 1 / -1;
}

.widget-card.size-half {
  grid-column: span 3;
}

.widget-card.size-third {
  grid-column: span 2;
}

/* Single stat widget (core stat cards) */
.single-stat-value {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  padding: 0.5rem 0;
}

/* Edit mode controls */
.widget-edit-controls {
  display: none;
  gap: 0.25rem;
  align-items: center;
}

.dashboard-edit-mode .widget-edit-controls {
  display: flex;
}

.widget-edit-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.widget-edit-btn:hover {
  color: var(--text-primary);
  background: var(--bg-input);
}

.widget-edit-btn.hide-btn:hover {
  color: var(--danger);
}

.widget-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0 0.25rem;
  user-select: none;
}

.widget-drag-handle:active {
  cursor: grabbing;
}

/* Drag feedback */
.widget-dragging {
  opacity: 0.4;
}

.widget-drop-target {
  box-shadow: 0 0 0 2px var(--accent);
}

/* Resize handle (right edge drag) */
.widget-resize-handle {
  display: none;
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
}

.widget-resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  border-radius: 2px;
  background: var(--text-muted);
  opacity: 0.4;
  transition: opacity 0.15s, background 0.15s;
}

.widget-resize-handle:hover::after {
  opacity: 1;
  background: var(--accent);
}

.dashboard-edit-mode .widget-resize-handle {
  display: block;
}

.widget-resizing {
  opacity: 0.7;
  box-shadow: 0 0 0 2px var(--accent);
}

/* Resize ghost overlay */
.resize-ghost {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(59, 130, 246, 0.1);
  border: 2px dashed var(--accent);
  border-radius: 8px;
  pointer-events: none;
  z-index: 5;
  transition: width 0.1s ease;
}

/* Hidden widgets bar */
.hidden-widgets-bar {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.hidden-widgets-bar.visible {
  display: flex;
}

/* Add Widget catalog header */
.add-widget-header {
  width: 100%;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

/* Add Widget catalog groups */
.add-widget-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.25rem 0;
}

.add-widget-group-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 80px;
  flex-shrink: 0;
}

.add-widget-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.hidden-widgets-bar .label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-self: center;
  margin-right: 0.5rem;
}

.hidden-widget-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.hidden-widget-chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* Responsive breakpoints */
@media (max-width: 1100px) {
  .widget-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .widget-card { grid-column: span 1; }
  .widget-card.size-full { grid-column: 1 / -1; }
  .widget-card.size-half { grid-column: span 1; }
  .widget-card.size-third { grid-column: span 1; }
}

@media (max-width: 700px) {
  .widget-grid {
    grid-template-columns: 1fr;
  }
  .widget-card,
  .widget-card.size-full,
  .widget-card.size-half,
  .widget-card.size-third {
    grid-column: span 1;
  }
}

.widget-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.widget-body {
  font-size: 0.875rem;
}

.widget-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.widget-stat {
  flex: 1;
  min-width: 80px;
  text-align: center;
}

.widget-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.widget-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.widget-kv-row {
  display: flex;
  justify-content: space-between;
  padding: 0.375rem 0;
  border-bottom: 1px solid rgba(55, 65, 81, 0.5);
}

.widget-kv-row:last-child {
  border-bottom: none;
}

.help-icon:hover::after {
  content: attr(data-help);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: normal;
  width: 250px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  line-height: 1.4;
}

/* ---- WFC Page ---- */
.wfc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.wfc-stats {
  display: flex;
  gap: 1.5rem;
}
.wfc-stat {
  text-align: center;
}
.wfc-stat .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.wfc-stat .value.accent { color: var(--accent); }
.wfc-stat .value.success { color: var(--success); }
.wfc-stat .value.warning { color: var(--warning); }
.wfc-stat .label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}
.wfc-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.wfc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.wfc-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.wfc-table td {
  padding: 0.4rem 0.75rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(55, 65, 81, 0.3);
  white-space: nowrap;
}
.wfc-table tr:hover td {
  background: rgba(59, 130, 246, 0.05);
}
.wfc-table tr.active td {
  color: var(--text-primary);
}
.wfc-table tr.idle td {
  color: var(--text-muted);
}
.node-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}
.node-status.active { background: var(--success); box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }
.node-status.idle { background: var(--text-muted); }
.node-status.offline { background: var(--danger); }
.protocol-tag {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
}
.protocol-tag.telnet { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.protocol-tag.modem { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.protocol-tag.binkp { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.protocol-tag.ssh { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }
.protocol-tag.webui { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.protocol-tag.fido { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.client-name {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.username-cell {
  font-weight: 600;
  color: var(--success);
}
.username-cell.empty {
  font-weight: 400;
  color: var(--text-muted);
  font-style: italic;
}
.client-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.client-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
}
.client-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.client-chip .dot.offline { background: var(--danger); }
.client-chip .name {
  color: var(--text-primary);
  font-weight: 500;
}
.client-chip .info {
  color: var(--text-muted);
}
.no-activity {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.no-activity h3 {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.uptime-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.wfc-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.wfc-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

/* ---- Logs Page ---- */
.log-filters {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.log-filters .form-group {
  margin-bottom: 0;
  min-width: 120px;
}
.log-filters select, .log-filters input {
  font-size: 0.8rem;
  padding: 0.4rem 0.5rem;
}
.log-row {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(55, 65, 81, 0.5);
  font-size: 0.8rem;
  align-items: flex-start;
}
.log-row:hover {
  background: rgba(255, 255, 255, 0.02);
}
.log-timestamp {
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 130px;
}
.log-level {
  min-width: 60px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
}
.log-level.info { color: var(--accent); }
.log-level.warning { color: #f59e0b; }
.log-level.error { color: var(--danger); }
.log-level.debug { color: var(--text-muted); }
.log-source {
  color: var(--text-secondary);
  min-width: 100px;
  white-space: nowrap;
}
.log-category {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  white-space: nowrap;
}
.log-message {
  flex: 1;
  color: var(--text-primary);
  word-break: break-word;
}
.log-details {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

/* ---- Nodes Page ---- */
.node-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.node-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.node-card.server-card {
  border-color: var(--accent);
  border-width: 2px;
  grid-column: 1 / -1;
}
.node-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.node-card-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}
.server-label {
  font-size: 0.65rem;
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 600;
  margin-left: 0.5rem;
}
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}
.status-online {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.status-offline {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.node-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem 1rem;
  font-size: 0.8rem;
}
.node-card:not(.server-card) .node-detail-grid {
  grid-template-columns: 1fr 1fr;
}
.node-detail {
  display: flex;
  flex-direction: column;
}
.node-detail .label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}
.node-detail .value {
  color: var(--text-primary);
  font-weight: 500;
}
.rtt-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}
.rtt-good { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.rtt-fair { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.rtt-poor { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.rtt-unknown { background: rgba(107, 114, 128, 0.15); color: #6b7280; }
.node-rtt-bar {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(55, 65, 81, 0.3);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  font-size: 0.7rem;
  text-align: center;
}
.node-rtt-bar .rtt-label { color: var(--text-muted); }
.node-rtt-bar .rtt-value { color: var(--text-secondary); font-weight: 500; }
.summary-bar {
  display: flex;
  gap: 2rem;
}
.summary-stat {
  text-align: center;
}
.summary-stat .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}
.summary-stat .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}
.no-nodes {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.no-nodes h3 {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.node-actions {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(55, 65, 81, 0.3);
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.node-actions .btn {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
}
.config-panel {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-size: 0.75rem;
  max-height: 500px;
  overflow-y: auto;
  display: none;
}
.config-panel.show { display: block; }
.config-section-title {
  color: var(--accent);
  font-weight: 600;
  margin-top: 0.4rem;
}
.config-section-title:first-child { margin-top: 0; }
.config-entry {
  display: flex;
  justify-content: space-between;
  padding: 0.1rem 0;
  color: var(--text-secondary);
}
.config-entry .config-key { color: var(--text-muted); }
.config-entry .config-val { color: var(--text-primary); font-weight: 500; }
.config-editable {
  cursor: pointer;
  border-bottom: 1px dashed rgba(99, 102, 241, 0.3);
}
.config-editable:hover {
  background: rgba(99, 102, 241, 0.1);
  border-radius: 2px;
}
.config-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.4rem;
}
.config-edit-input {
  background: var(--bg-input);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-family: inherit;
  width: auto;
  min-width: 60px;
  max-width: 160px;
}
.config-save-btn {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  margin-left: 0.2rem;
  cursor: pointer;
}
.config-save-btn:hover { background: rgba(16, 185, 129, 0.35); }
.config-cancel-btn {
  background: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.3);
  margin-left: 0.15rem;
  cursor: pointer;
}
.config-cancel-btn:hover { background: rgba(107, 114, 128, 0.35); }
.plugin-list { margin: 0.25rem 0; }
.plugin-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(55, 65, 81, 0.3);
  font-size: 0.75rem;
}
.plugin-item:last-child { border-bottom: none; }
.plugin-name {
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-primary);
}
.plugin-version {
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 0.7rem;
}
.plugin-item .status-badge {
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  flex-shrink: 0;
}
.plugin-item-actions {
  margin-left: auto;
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}
.plugin-item-actions .btn {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
}
.btn-icon-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 0.8rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
}
.btn-icon-danger:hover {
  background: var(--danger);
  color: white;
}
.plugin-section-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin: 0.4rem 0 0.2rem;
}

/* ---- Groups Page ---- */
.split-panel {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
}
.list-panel {
  max-height: 600px;
  overflow-y: auto;
}
.list-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.list-item:hover { background: var(--bg-input); }
.list-item.selected {
  background: var(--bg-input);
  border-left: 3px solid var(--accent);
  padding-left: calc(1rem - 3px);
}
.list-item .item-name { font-weight: 500; }
.list-item .item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.detail-panel { min-height: 400px; }
.detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-muted);
}
.flag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.flag-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
}
.flag-item input[type="checkbox"] { width: auto; margin: 0; }
.flag-item .flag-name { font-weight: 500; color: var(--text-primary); }
.flag-item .flag-desc { font-size: 0.7rem; color: var(--text-muted); }
.flag-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin: 0.75rem 0 0.4rem;
}
.member-list { max-height: 200px; overflow-y: auto; }
.member-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(55, 65, 81, 0.5);
  font-size: 0.85rem;
}
.member-row:hover { background: rgba(255,255,255,0.02); }
.flag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(55, 65, 81, 0.5);
  font-size: 0.85rem;
}
.flag-row:hover { background: rgba(255,255,255,0.02); }

/* ---- Scheduler Page ---- */
.task-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.task-table th { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 2px solid var(--border); color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; }
.task-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid rgba(55, 65, 81, 0.5); }
.task-table tr:hover { background: rgba(255, 255, 255, 0.02); }
.status-success { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.status-error { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.status-disabled { background: rgba(107, 114, 128, 0.15); color: #6b7280; }
.status-pending { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
.status-running { background: rgba(245, 158, 11, 0.15); color: #f59e0b; animation: sched-run-pulse 1s ease-in-out infinite; }
@keyframes sched-run-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.task-actions { display: flex; gap: 0.3rem; }
.task-actions .btn { font-size: 0.7rem; padding: 0.2rem 0.5rem; }
.plugin-badge { background: rgba(99, 102, 241, 0.15); color: var(--accent); padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.7rem; }
.schedule-text { color: var(--text-secondary); font-size: 0.8rem; }
.time-text { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.cron-presets { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.3rem; }
.cron-presets .btn { font-size: 0.65rem; padding: 0.15rem 0.4rem; }
.log-entry { display: flex; gap: 0.75rem; padding: 0.4rem 0.75rem; border-bottom: 1px solid rgba(55, 65, 81, 0.3); font-size: 0.8rem; align-items: center; }
.log-entry:hover { background: rgba(255, 255, 255, 0.02); }
.log-time { color: var(--text-muted); white-space: nowrap; min-width: 130px; }
.log-task { color: var(--text-secondary); min-width: 150px; }
.log-duration { color: var(--text-muted); min-width: 60px; text-align: right; }

/* ---- Update Banner ---- */
.update-banner {
  background: var(--accent);
  color: white;
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  position: relative;
  z-index: 1000;
}
.update-banner a {
  color: white;
  font-weight: 600;
  text-decoration: underline;
  margin-left: 0.5rem;
}

/* ---- Hamburger Button (mobile only) ---- */
.hamburger {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1100;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.hamburger.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---- Sidebar Overlay (mobile only) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

/* ---- Mobile Responsive (768px) ---- */
@media (max-width: 768px) {
  html { font-size: 13px; }

  .hamburger { display: flex; }

  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    z-index: 1050;
    width: 240px;
    transition: left 0.25s ease;
  }
  .sidebar.open { left: 0; }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    padding: 1rem;
    padding-top: 3.5rem;
    width: 100%;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }

  /* Tables: horizontal scroll */
  .table-container,
  .card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
  }

  /* Stats grid: 2 columns on mobile */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  /* Forms: full width */
  .form-row {
    flex-direction: column;
  }

  /* Modals: full width on mobile */
  .modal-content {
    width: 95%;
    max-width: none;
    margin: 1rem;
  }

  /* Buttons: stack on mobile */
  .btn-group {
    flex-direction: column;
    width: 100%;
  }
  .btn-group .btn {
    width: 100%;
    justify-content: center;
  }

  /* Node cards: stack */
  .node-grid {
    grid-template-columns: 1fr;
  }

  /* Toast: full width on mobile */
  .toast-container {
    left: 0.5rem;
    right: 0.5rem;
    top: auto;
    bottom: 0.5rem;
  }
  .toast {
    min-width: auto;
    width: 100%;
  }
}

/* ---- Tablet (768px - 1100px) ---- */
@media (min-width: 769px) and (max-width: 1100px) {
  .sidebar { width: 200px; }
  .sidebar-nav li a { font-size: 0.75rem; padding: 0.4rem 1.25rem 0.4rem 1.75rem; }
  .main-content { padding: 1.25rem; }
}
