:root {
  --bg-primary: #f0f4f8;
  --bg-card: #ffffff;
  --bg-sidebar: #1e2a3a;
  --sidebar-text: #a8bbd0;
  --sidebar-active: #ffffff;
  --accent-blue: #4a90d9;
  --status-ok: #48bb78;
  --status-warning: #ecc94b;
  --status-critical: #fc8181;
  --status-unknown: #a0aec0;
  --text-primary: #2d3748;
  --text-secondary: #718096;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--bg-sidebar);
  color: var(--sidebar-text);
  padding: 24px 16px;
}

.sidebar h2 {
  color: var(--sidebar-active);
  margin: 0 0 20px;
}

.sidebar a {
  display: block;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 10px 8px;
  border-radius: 8px;
}

.sidebar a.active,
.sidebar a:hover {
  color: var(--sidebar-active);
  background: rgba(255, 255, 255, 0.08);
}

.content {
  flex: 1;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
}

.pill {
  padding: 12px;
  border-radius: 10px;
  color: #fff;
  font-weight: bold;
  text-align: center;
}

.ok {
  background: var(--status-ok);
}

.warning {
  background: var(--status-warning);
  color: #333;
}

.critical {
  background: var(--status-critical);
}

.unreachable {
  background: var(--status-unknown);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.muted {
  color: var(--text-secondary);
  font-size: 12px;
}

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

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

th,
td {
  border-bottom: 1px solid #e8edf3;
  text-align: left;
  padding: 10px 6px;
  font-size: 14px;
}

input,
select,
button,
textarea {
  padding: 8px;
  border: 1px solid #ccd6e0;
  border-radius: 8px;
  font-size: 14px;
}

button {
  cursor: pointer;
  background: var(--accent-blue);
  color: #fff;
  border: 0;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.loading-spinner,
.error-msg {
  padding: 8px 0;
  font-size: 13px;
}

@keyframes pulse {
  0% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.5;
  }
}

.pulse-dot {
  animation: pulse 1.2s infinite;
}

/* Storage section */
.storage-section {
  margin-top: 16px;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
}

.storage-group {
  margin-bottom: 20px;
}

.storage-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.storage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.storage-table th {
  text-align: left;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid #e2e8f0;
}

.storage-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f7fafc;
  vertical-align: middle;
}

.storage-table tr:last-child td {
  border-bottom: none;
}

.drive-row-alert td {
  background-color: #fff5f5;
}

.status-pill,
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.status-OK {
  background: #f0fff4;
  color: #276749;
}

.status-Warning {
  background: #fffff0;
  color: #744210;
}

.status-Critical {
  background: #fff5f5;
  color: #9b2335;
}

.status-Unknown {
  background: #f7fafc;
  color: #718096;
}

.media-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.media-hdd {
  background: #ebf8ff;
  color: #2b6cb0;
}

.media-ssd {
  background: #f0fff4;
  color: #276749;
}

.media-nvme {
  background: #faf5ff;
  color: #553c9a;
}

.raid-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #edf2f7;
  color: #4a5568;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
}

.hotspare-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #ebf8ff;
  color: #2b6cb0;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
}

.slot-label {
  font-family: monospace;
  font-size: 11px;
  color: var(--text-secondary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono {
  font-family: monospace;
  font-size: 12px;
}

.storage-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 10px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-container {
  position: relative;
  height: 200px;
  width: 100%;
  margin: 12px 0;
}

.chart-container canvas {
  display: block;
}

.server-card.expanded .card-detail {
  overflow: hidden;
}

.card-detail {
  border-top: 1px solid #e2e8f0;
  padding: 14px 16px 16px;
  overflow: hidden;
}

.detail-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 4px;
}

.detail-block {
  background: #f7fafc;
  border-radius: 8px;
  padding: 10px 12px;
}

.detail-block-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.temp-readings {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.temp-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.temp-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.temp-value {
  font-size: 13px;
  font-weight: 600;
  font-family: monospace;
}

.temp-ok {
  color: #276749;
}

.temp-warm {
  color: #744210;
}

.temp-hot {
  color: #9b2335;
}

.quick-stats {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.stat-label {
  color: var(--text-secondary);
  width: 40px;
  flex-shrink: 0;
}

.stat-value {
  color: var(--text-primary);
  font-family: monospace;
}

.status-dot {
  font-size: 10px;
}

.status-dot.status-OK {
  color: #48bb78;
}

.status-dot.status-Warning {
  color: #ecc94b;
}

.status-dot.status-Critical {
  color: #fc8181;
}

.status-dot.status-Unknown {
  color: #a0aec0;
}

.controller-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}

.storage-ctrl-name {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
}

.vd-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: #f7fafc;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 12px;
}

.vd-name {
  flex: 1;
  font-weight: 500;
}

.drive-row-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 2px;
}

.drive-row-compact:hover {
  background: #f7fafc;
}

.drive-alert {
  background: #fff5f5 !important;
}

.drive-slot {
  font-family: monospace;
  font-size: 11px;
  color: var(--text-secondary);
  width: 42px;
  flex-shrink: 0;
}

.drive-model {
  flex: 1;
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.drive-cap {
  font-family: monospace;
  font-size: 11px;
  width: 55px;
  text-align: right;
  flex-shrink: 0;
}

.media-unknown {
  background: #edf2f7;
  color: #4a5568;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 380px;
}

@media (max-width: 900px) {
  .app {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
  }
  .sidebar h2 {
    margin: 0 12px 0 0;
    white-space: nowrap;
  }
}
