* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #0c0f14;
  color: #e6e8ee;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px 40px;
  background: linear-gradient(120deg, #10182b, #1b2340);
  border-bottom: 1px solid #1c2640;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.subtitle {
  margin: 4px 0 0;
  color: #9aa6c1;
  font-size: 14px;
}

.nav {
  display: flex;
  gap: 12px;
  margin-left: auto;
  margin-right: 24px;
}

.nav-link {
  color: #c6d3f0;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.active,
.nav-link:hover {
  background: rgba(58, 109, 240, 0.3);
}

.status {
  padding: 8px 16px;
  border-radius: 999px;
  background: #1d243a;
  font-weight: 600;
}

.status.ok {
  background: #153b2a;
  color: #6ce3a2;
}

.status.warn {
  background: #3a1e1e;
  color: #ff9b9b;
}

.controls {
  display: flex;
  gap: 16px;
  padding: 20px 40px;
  align-items: end;
  flex-wrap: wrap;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control label {
  font-size: 12px;
  color: #9aa6c1;
}

.control input,
.control select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #232a3f;
  background: #111826;
  color: #e6e8ee;
}

button#refreshBtn {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: #3a6df0;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 0 40px 20px;
}

.card {
  background: #121a2b;
  border: 1px solid #1b2540;
  padding: 16px;
  border-radius: 12px;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #9aa6c1;
}

.card .big {
  font-size: 20px;
  font-weight: 700;
}

.table-wrap {
  padding: 0 40px 40px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #0f1524;
  border: 1px solid #1b2540;
  border-radius: 12px;
  overflow: hidden;
}

thead {
  background: #131c30;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #1b2540;
  text-align: left;
  font-size: 13px;
}

tbody tr:nth-child(even) {
  background: #111827;
}

.muted {
  color: #6b7280;
  text-align: center;
}

.footer {
  padding: 16px 40px 32px;
  color: #9aa6c1;
  display: flex;
  gap: 8px;
}

.page {
  padding: 24px 40px 40px;
}

.panel {
  background: #121a2b;
  border: 1px solid #1b2540;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.panel p {
  margin: 0 0 12px;
  color: #9aa6c1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.btn {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: #3a6df0;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.btn.secondary {
  background: #233257;
  color: #d7def2;
}

.btn.danger {
  background: #b02a37;
}

.status-line {
  margin-top: 12px;
  color: #9aa6c1;
  font-size: 13px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.toggle input {
  width: 44px;
  height: 24px;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.device-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.chart-card {
  background: #0f1524;
  border: 1px solid #1b2540;
  border-radius: 12px;
  padding: 16px;
}

.chart-card canvas {
  width: 100%;
  height: 420px;
}

.inline-note {
  font-size: 12px;
  color: #9aa6c1;
}
