﻿/* ===========================================
   璁惧鍦ㄧ嚎绠＄悊骞冲彴 鈥?鏍峰紡
   =========================================== */

:root {
  --bg:        #f4f5f7;
  --card-bg:   #ffffff;
  --text:      #1a1a2e;
  --muted:     #6b7280;
  --border:    #e5e7eb;
  --online:    #10b981;
  --offline:   #ef4444;
  --accent:    #3b82f6;
  --accent-h:  #2563eb;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- 椤舵爮 ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 600; }
.poll-indicator { font-size: 12px; color: var(--online); }
.poll-indicator.stale { color: var(--offline); }

/* ---- 缁熻鍗＄墖 ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  padding: 20px 28px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-online .stat-value { color: var(--online); }
.stat-offline .stat-value { color: var(--offline); }

/* ---- 涓昏〃鏍煎尯 ---- */
.main-content { padding: 0 28px 28px; }
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.section-header h2 { font-size: 16px; font-weight: 600; }
.last-update { font-size: 12px; color: var(--muted); }

.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 14px; text-align: left; white-space: nowrap; }
th {
  background: #f9fafb;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
}
td { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: #f8fafc; }

/* 鐘舵€佹爣绛?*/
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.status-online  { background: #d1fae5; color: #065f46; }
.status-offline { background: #fee2e2; color: #991b1b; }

/* 瀹炴椂鏁版嵁楂樹寒 */
.live-speed, .live-km {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.heartbeat-stale { color: var(--muted); }

/* ---- 鎸夐挳 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  transition: background .15s;
}
.btn:hover { background: #f3f4f6; }

/* ---- 寮圭獥 ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--card-bg);
  border-radius: 10px;
  width: 700px;
  max-width: 95vw;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
.modal-body { padding: 18px 20px; overflow-y: auto; }

/* 寮圭獥鍐呰〃鏍?*/
.detail-section { margin-bottom: 20px; }
.detail-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.detail-table th,
.detail-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.detail-table th { background: #f9fafb; font-weight: 600; color: var(--muted); }

.duration-cell { font-variant-numeric: tabular-nums; }

/* ---- 鍝嶅簲寮?---- */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-direction: column; gap: 6px; }
}

/* ---- 登录页面 ---- */
.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px 36px;
  width: 380px;
  max-width: 92vw;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.login-box h1 {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}
.login-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
}
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--accent); }

.login-error {
  color: var(--offline);
  font-size: 12px;
  min-height: 18px;
  margin-bottom: 8px;
}
.btn-login {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-login:hover { background: var(--accent-h); }
.btn-login:disabled { opacity: .6; cursor: not-allowed; }

/* ---- 顶栏用户区 ---- */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
}
.current-user { font-size: 13px; color: var(--text); }
.btn-logout {
  padding: 4px 12px;
  font-size: 12px;
  border-color: var(--offline);
  color: var(--offline);
}
.btn-logout:hover { background: #fef2f2; }
