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

:root {
  --bg-primary: #0a0e17;
  --bg-card: #111827;
  --border: #1e293b;
  --accent: #00ff99;
  --accent-glow: rgba(0, 255, 153, 0.15);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-dim: #64748b;
  --mem-color: #38bdf8;
}

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

.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

header {
  text-align: center;
  margin-bottom: 28px;
}

header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.header-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.header-info {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.admin-badge {
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.admin-badge:hover {
  border-color: #f59e0b;
  color: #f59e0b;
}

.admin-badge.admin-active {
  background: #f59e0b22;
  border-color: #f59e0b;
  color: #f59e0b;
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9000;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 340px;
  max-width: 90vw;
  overflow: hidden;
}

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

.modal-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: monospace;
  outline: none;
  transition: border-color 0.2s;
}

.modal-input:focus {
  border-color: var(--accent);
}

.modal-input::placeholder {
  color: var(--text-dim);
}

.modal-error {
  background: #ef444422;
  border: 1px solid #ef444466;
  color: #ef4444;
  font-size: 0.75rem;
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 10px;
}

.modal-btn {
  width: 100%;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 14px;
  transition: opacity 0.2s;
}

.modal-btn:hover {
  opacity: 0.85;
}

.modal-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Gauges */
.gauges-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.gauge-card, .info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.gauge-card:hover, .info-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.gauge-wrapper {
  position: relative;
  width: 180px;
  height: 180px;
  margin-bottom: 12px;
}

.gauge-wrapper canvas {
  display: block;
  width: 180px;
  height: 180px;
}

.gauge-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.gauge-value {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: monospace;
  display: block;
  line-height: 1;
}

.gauge-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 2px;
}

.gauge-details {
  display: flex;
  gap: 14px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Uptime */
.uptime-display { text-align: center; }

.uptime-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 14px;
}

.uptime-values {
  display: flex;
  gap: 6px;
}

.uptime-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 48px;
}

.uptime-num {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  font-family: monospace;
  line-height: 1;
}

.uptime-text {
  font-size: 0.55rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 3px;
}

/* Device info */
.device-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.device-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}

.device-icon {
  font-size: 1.4rem;
  width: 32px;
  text-align: center;
}

.device-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.device-val {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: monospace;
}

.device-val small {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 400;
}

.temp-warn { color: #f59e0b !important; }
.temp-hot { color: #ef4444 !important; }

/* Network/Disk cards */
.net-card {
  padding: 16px;
}

/* Charts */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.chart-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.chart-header h2 {
  font-size: 0.9rem;
  font-weight: 600;
}

.range-buttons {
  display: flex;
  gap: 2px;
  background: var(--bg-primary);
  border-radius: 6px;
  padding: 2px;
}

.range-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.range-btn:hover { color: var(--text-secondary); }

.range-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
}

.chart-container {
  position: relative;
  height: 180px;
}

.chart-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 8px;
}

.chart-footer strong {
  color: var(--text-secondary);
  font-family: monospace;
}

/* Process table */
.proc-section {
  margin-top: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.proc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.proc-header h2 {
  font-size: 0.9rem;
  font-weight: 600;
}

.proc-table-wrap {
  overflow-x: auto;
}

.proc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  font-family: monospace;
}

.proc-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.6rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
}

.proc-table td {
  padding: 6px 10px;
  color: var(--text-secondary);
  border-bottom: 1px solid #1e293b44;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proc-table td:first-child {
  white-space: nowrap;
}

.proc-table td:nth-child(2) {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proc-table tr:hover td {
  background: #1e293b33;
  color: var(--text-primary);
}

.proc-table .col-cpu { color: var(--accent); font-weight: 600; }
.proc-table .col-mem { color: var(--mem-color); }
.proc-table .col-mem-high { color: #f59e0b; font-weight: 600; }
.proc-table .col-pid { color: var(--text-dim); }
.proc-table .col-time { color: var(--text-dim); }

.proc-loading {
  text-align: center;
  color: var(--text-dim);
  padding: 20px !important;
}

/* Kill button */
.kill-btn {
  background: transparent;
  border: 1px solid #ef444466;
  color: #ef4444;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: monospace;
  font-weight: 700;
}

.kill-btn:hover {
  background: #ef444422;
  border-color: #ef4444;
}

.kill-btn.killing {
  color: #f59e0b;
  border-color: #f59e0b;
  cursor: wait;
}

.kill-btn.killed {
  color: #00ff99;
  border-color: #00ff99;
  cursor: default;
}

.kill-btn.kill-fail {
  color: #ef4444;
  border-color: #ef4444;
  cursor: default;
}

@media (max-width: 850px) {
  .gauges-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .gauges-row { grid-template-columns: 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .dashboard { padding: 12px; }
}
