:root {
  color-scheme: light;
  --bg: #0f1623;
  --panel: #ffffff;
  --text: #122033;
  --muted: #64748b;
  --line: #e2e8f0;
  --teal: #0f766e;
  --blue: #2563eb;
  --red: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    "Segoe UI",
    "Microsoft YaHei",
    Arial,
    sans-serif;
  margin: 0;
}

button,
input {
  font: inherit;
}

.page-shell {
  margin: 0 auto;
  max-width: 1240px;
  padding: 34px 18px 48px;
}

.topbar,
.settings-panel,
.summary-grid,
.content-grid {
  margin-bottom: 18px;
}

.topbar {
  align-items: center;
  color: #ffffff;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.eyebrow {
  color: #8fb3d9;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 2rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.08rem;
}

.subtitle {
  color: #bdd0e6;
  margin-top: 8px;
}

button {
  background: var(--teal);
  border: 0;
  border-radius: 7px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  min-height: 40px;
  padding: 0 16px;
}

button.secondary {
  background: #eef2f7;
  color: var(--text);
}

.settings-panel,
.metric-card,
.panel,
.message {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}

.settings-panel {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1.2fr) minmax(220px, 0.8fr) 170px auto;
  padding: 16px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.84rem;
  font-weight: 800;
  gap: 6px;
}

input {
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  color: var(--text);
  min-height: 40px;
  padding: 0 11px;
}

.message {
  color: var(--red);
  font-weight: 800;
  padding: 14px 16px;
}

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

.metric-card {
  min-height: 138px;
  padding: 20px;
}

.metric-card.primary {
  background: linear-gradient(135deg, #0f766e, #155e75);
  color: #ffffff;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  display: block;
  font-weight: 800;
}

.metric-card.primary span,
.metric-card.primary small {
  color: rgba(255, 255, 255, 0.78);
}

.metric-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1.15;
  margin: 15px 0 10px;
}

.content-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
}

.panel {
  min-height: 520px;
  padding: 22px;
}

.panel-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

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

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

th,
td {
  border-bottom: 1px solid #edf2f7;
  padding: 12px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f8fafc;
}

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 800;
  min-height: 26px;
  padding: 4px 10px;
}

.status.online {
  background: #dcfce7;
  color: #166534;
}

.status.offline {
  background: #f1f5f9;
  color: #475569;
}

.detail-empty {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  min-height: 110px;
  padding: 20px;
}

#deviceDetail h3 {
  font-size: 0.98rem;
  margin: 22px 0 8px;
}

.summary-line {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  line-height: 1.7;
  padding: 14px 16px;
}

.rank-list,
.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rank-list li,
.event-list li {
  border-bottom: 1px solid #edf2f7;
  padding: 12px 0;
}

.rank-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.rank-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row span {
  flex-shrink: 0;
}

.progress-track {
  background: #e2e8f0;
  border-radius: 999px;
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill {
  background: linear-gradient(90deg, #14b8a6, #38bdf8);
  height: 100%;
}

.progress-fill.website {
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.event-list strong {
  word-break: break-word;
}

.event-list small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

@media (max-width: 980px) {
  .settings-panel,
  .summary-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
}
