:root {
  color-scheme: dark;
  --bg: #0a1924;
  --sidebar: #08151f;
  --panel: #0d2230;
  --border: #234454;
  --muted: #99b8c9;
  --text: #e5f3fa;
  --accent: #28cee8;
  --selected: #153e51;
  --danger: #ffb1ac;
  font: 14px/1.5 Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(27px, 3vw, 36px); letter-spacing: -.025em; line-height: 1.18; }
h2 { font-size: 19px; line-height: 1.3; }
p { color: var(--muted); }
.brand { color: var(--text); font-size: 24px; font-weight: 780; letter-spacing: -.055em; }
.brand span { color: var(--accent); }
.outline-button, .period-group button {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 13px;
}
.outline-button:hover, .period-group button:hover { background: var(--selected); }
.period-group button[aria-pressed="true"] { background: #17526a; border-color: #247b99; }
.primary-button {
  border: 0;
  border-radius: 6px;
  padding: 11px 14px;
  background: var(--accent);
  color: #07202a;
  font-weight: 750;
}
.primary-button:hover { background: #63deef; }
.login-page { display: grid; place-items: center; padding: 28px; }
.login-panel { width: min(100%, 410px); padding: 36px; background: var(--panel); border: 1px solid var(--border); border-radius: 13px; }
.login-panel h1 { margin: 24px 0 26px; font-size: 26px; }
.login-panel label { display: block; margin-bottom: 7px; font-weight: 620; }
.login-panel input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  margin-bottom: 17px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.login-panel .primary-button { width: 100%; margin-top: 6px; }
.form-error { color: var(--danger); margin-bottom: 12px; }
.dashboard-page { display: grid; grid-template-columns: 222px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 100dvh;
  padding: 28px 15px 20px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}
.sidebar .brand { margin: 0 7px 34px; }
.side-nav { display: grid; gap: 5px; }
.side-nav a { padding: 11px 14px; border-radius: 6px; border-left: 2px solid transparent; }
.side-nav a:hover, .side-nav a[aria-current] { background: var(--selected); }
.side-nav a[aria-current] { border-left-color: var(--accent); font-weight: 650; }
.side-nav span { margin-left: 4px; }
.logout { align-self: start; margin: auto 7px 0; color: var(--muted); }
.content { width: 100%; max-width: 1760px; margin: 0 auto; padding: clamp(24px, 3.3vw, 64px); }
.page-heading, .panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-heading p { margin-top: 8px; }
.site-address a:hover { color: var(--accent); }
.period-group { display: flex; flex-wrap: wrap; gap: 6px; }
.measurement-note { font-size: 13px; margin: 30px 0 9px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 950px; gap: 13px; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 20px; }
.metric { display: flex; align-items: center; gap: 14px; min-height: 119px; }
.metric svg { flex: 0 0 23px; fill: none; stroke: var(--accent); stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.metric h2 { color: var(--muted); font-size: 13px; font-weight: 640; }
.metric strong { display: block; margin: 3px 0; color: var(--accent); font-size: 29px; line-height: 1.15; }
.metric p, .live-panel p, .chart-panel p { font-size: 13px; }
.live-panel { margin-top: 16px; }
.live-panel h2 { margin: 9px 0; }
.live-panel h2 strong { color: var(--accent); }
.eyebrow { color: var(--accent); font-size: 12px; margin-bottom: 9px; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px #28cee825; }
.online-rows { min-height: 54px; border-top: 1px solid var(--border); margin-top: 16px; padding-top: 14px; }
.online-rows p { padding: 3px 0; }
.online-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.online-row span:first-child { color: var(--text); overflow-wrap: anywhere; }
.last-updated { margin-top: 16px; }
.chart-panels { display: grid; grid-template-columns: 2fr minmax(235px, 1fr); gap: 16px; margin-top: 16px; }
.chart-panel h2, .devices-panel h2 { margin-bottom: 6px; }
.chart-wrap { margin-top: 22px; }
#views-chart { width: 100%; height: 248px; display: block; }
#chart-value { min-height: 21px; text-align: center; }
.daily-details { margin-top: 8px; color: var(--muted); font-size: 13px; }
.daily-details summary { cursor: pointer; }
.daily-details .table-scroll { max-height: 280px; overflow: auto; margin-top: 10px; }
.device { margin-top: 18px; }
.device div { display: flex; justify-content: space-between; gap: 8px; }
.device span:last-child { color: var(--muted); }
.device progress { appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 999px; background: #153344; margin-top: 8px; }
.device progress::-webkit-progress-bar { background: #153344; border-radius: 999px; }
.device progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.device progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.list-panel { margin-top: 24px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); }
th { font-size: 13px; color: var(--muted); }
td { overflow-wrap: anywhere; }
.empty { padding: 26px 10px; }
.message { border-bottom: 1px solid var(--border); padding: 14px 0; }
.message summary { cursor: pointer; font-weight: 650; overflow-wrap: anywhere; }
.message summary small { color: var(--accent); margin-left: 8px; font-weight: 500; }
.message p { margin: 9px 0; overflow-wrap: anywhere; }
.message .message-body { color: var(--text); white-space: pre-wrap; }
.more { margin-top: 16px; }
@media (max-width: 970px) {
  .dashboard-page { grid-template-columns: 182px minmax(0, 1fr); }
  .content { padding: 28px 22px; }
  .metrics { gap: 9px; }
  .metric { padding: 14px 11px; gap: 8px; }
  .chart-panels { grid-template-columns: 1fr; }
}
@media (max-width: 660px) {
  .dashboard-page { display: block; }
  .sidebar { position: static; height: auto; padding: 14px 14px 10px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { margin: 0 3px 12px; }
  .side-nav { display: flex; flex-wrap: wrap; gap: 3px; }
  .side-nav a { padding: 7px 9px; font-size: 13px; }
  .logout { margin: 10px 3px 0; padding: 6px 8px; font-size: 12px; }
  .content { padding: 22px 14px; }
  .page-heading { flex-wrap: wrap; }
  .measurement-note { margin-top: 20px; }
  .metric { min-height: 103px; }
  .metric svg { display: none; }
  .metric strong { font-size: 24px; }
  .metric p { font-size: 11px; }
  .panel { padding: 15px; }
}
