/* 产品云台 — 移动优先，桌面 ≥900px 双栏宫格 */
:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d212b;
  --border: #262b36;
  --text: #e8eaf0;
  --text-sub: #8b93a3;
  --accent: #4f8cff;
  --warn: #ffb020;
  --danger: #ff5d5d;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
html { color-scheme: dark; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ===== 登录页 ===== */
#view-login {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px 28px;
  text-align: center;
}
.login-logo { width: 72px; height: 72px; border-radius: 16px; }
.login-title { font-size: 22px; margin-top: 16px; letter-spacing: 2px; }
.login-sub { color: var(--text-sub); font-size: 13px; margin-top: 6px; margin-bottom: 28px; }
#login-form input {
  width: 100%; padding: 13px 14px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 16px; outline: none;
}
#login-form input:focus { border-color: var(--accent); }
#login-form button {
  width: 100%; margin-top: 14px; padding: 13px;
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  font-size: 16px; font-weight: 600;
}
#login-form button:active { opacity: .85; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.topbar-title img { width: 26px; height: 26px; border-radius: 7px; }
#site-avatar { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn {
  background: none; border: none; color: var(--text-sub);
  font-size: 22px; padding: 4px 8px; line-height: 1;
}
.icon-btn:active { color: var(--text); }

.container { padding: 16px 16px calc(24px + var(--safe-bottom)); max-width: 720px; margin: 0 auto; }

/* ===== 集成信息卡 ===== */
.overview-card {
  background: linear-gradient(160deg, #1a2233 0%, var(--panel) 60%);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 16px; margin-bottom: 16px;
}
.overview-head { display: flex; justify-content: space-between; align-items: baseline; }
.overview-head h2 { font-size: 15px; font-weight: 600; color: var(--text); }
.overview-time { font-size: 11px; color: var(--text-sub); }
.overview-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: 14px;
}
.stat-num { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-num.warn { color: var(--warn); }
.stat-label { font-size: 11px; color: var(--text-sub); margin-top: 3px; }
.overview-events { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.overview-events .evt-line {
  display: flex; gap: 8px; font-size: 12px; color: var(--text-sub);
  padding: 3px 0; align-items: baseline;
}
.evt-line .evt-time { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.evt-line .evt-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== 站点卡片 ===== */
.site-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.site-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  position: relative; overflow: hidden;
  transition: transform .1s;
}
.site-card:active { transform: scale(.98); }
.site-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--site-color, var(--accent));
}
.site-card-head { display: flex; align-items: center; gap: 12px; }
.site-card-head img { width: 44px; height: 44px; border-radius: 12px; }
.site-card-name { font-size: 16px; font-weight: 600; }
.site-card-sub { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.site-status {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-sub); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4a5162; }
.dot.live { background: #34d274; box-shadow: 0 0 6px #34d27466; }
.dot.warn { background: var(--warn); }
.site-card-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 14px;
}
.site-card-metrics .m-num { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.site-card-metrics .m-num.warn { color: var(--warn); }
.site-card-metrics .m-label { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.site-card-empty { font-size: 12px; color: var(--text-sub); margin-top: 12px; }

/* ===== 详情页 ===== */
.metric-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: 16px;
}
.metric-cell {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
}
.metric-cell .m-num { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-cell .m-label { font-size: 11px; color: var(--text-sub); margin-top: 4px; }
.metric-cell .m-time { font-size: 10px; color: #5a6172; margin-top: 2px; }
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.panel h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.report-item {
  border-top: 1px solid var(--border); padding: 10px 0; font-size: 13px;
}
.report-item:first-of-type { border-top: none; }
.report-item .r-head { display: flex; gap: 8px; align-items: center; }
.report-item .r-slot { font-size: 11px; padding: 2px 8px; border-radius: 6px; }
.r-slot.morning { background: #2a2415; color: var(--warn); }
.r-slot.evening { background: #1a2340; color: #7aa5ff; }
.report-item .r-date { color: var(--text-sub); font-size: 12px; }
.evt-line { padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.evt-line:first-child { border-top: none; }
.empty-hint { color: var(--text-sub); font-size: 13px; padding: 14px 0; text-align: center; }

/* ===== 桌面端 ≥900px：上半集成信息，下半宫格 ===== */
@media (min-width: 900px) {
  .container { max-width: 1080px; }
  .overview-stats { grid-template-columns: repeat(8, 1fr); }
  .overview-stats .stat:nth-child(n+5) { display: flex; flex-direction: column; justify-content: flex-end; }
  .site-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
}
