/* ===== 智慧能耗管家 Pro — 样式表 ===== */


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

:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e2e8f0;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: var(--text);
}

/* ===== 导航栏 ===== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(226,232,240,0.6);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.brand-icon svg { width: 20px; height: 20px; }
.brand-text {
  font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-tag {
  font-size: 10px; font-weight: 600;
  padding: 2px 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white; border-radius: 6px;
}

.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 8px 16px; text-decoration: none;
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  border-radius: 8px; transition: all 0.2s;
}
.nav-link:hover { color: var(--primary); background: rgba(99,102,241,0.08); }
.nav-link.active { color: var(--primary); background: rgba(99,102,241,0.12); }

.nav-actions { display: flex; align-items: center; gap: 16px; }
.nav-actions .username { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.btn-logout {
  padding: 6px 12px; border: 1px solid var(--border); background: white;
  border-radius: 8px; font-size: 12px; color: var(--text-secondary);
  cursor: pointer; transition: all 0.2s;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

.vehicle-selector {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 12px;
  background: #f1f5f9; border-radius: 10px;
}
.vehicle-selector select {
  border: none; background: none; font-size: 13px; color: var(--text);
  outline: none; cursor: pointer; font-weight: 500; padding: 4px 0;
}

/* ===== 主内容区 ===== */
.main-content { padding: 24px 32px; max-width: 1440px; margin: 0 auto; }

/* ===== 欢迎横幅 ===== */
.welcome-banner {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  border-radius: 20px; padding: 28px 36px; color: white; margin-bottom: 24px;
  box-shadow: 0 10px 40px rgba(99,102,241,0.3);
}
.welcome-text h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.welcome-text p { font-size: 14px; opacity: 0.9; }
.welcome-text strong { opacity: 1; font-weight: 700; }

.quick-actions { display: flex; gap: 12px; }

.btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.2s; text-decoration: none;
}
.btn-primary {
  background: white; color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.btn-ghost {
  background: rgba(255,255,255,0.2); color: white;
  border: 1px solid rgba(255,255,255,0.3);
}
.btn-ghost:hover { background: rgba(255,255,255,0.3); }

/* ===== 统计卡片网格 ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 20px; margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg); border-radius: 16px; padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid rgba(226,232,240,0.6);
  transition: all 0.3s;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(0,0,0,0.08); }
.stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.stat-trend {
  display: flex; align-items: center; gap: 2px;
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
}
.stat-trend.up { color: var(--danger); background: rgba(239,68,68,0.1); }
.stat-trend.down { color: var(--success); background: rgba(16,185,129,0.1); }
.stat-trend.neutral { color: var(--text-muted); background: rgba(156,163,175,0.1); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.stat-value .unit { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: -4px; }

/* ===== 内容行布局 ===== */
.content-row {
  display: grid; grid-template-columns: 1.2fr 1fr;
  gap: 20px; margin-bottom: 24px;
}
.content-row:last-child { grid-template-columns: 1fr 1fr 1fr; }

.chart-panel, .records-panel, .vehicle-panel, .cost-panel, .types-panel {
  background: var(--card-bg); border-radius: 16px; padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid rgba(226,232,240,0.6);
}

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.panel-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }

.panel-tabs {
  display: flex; gap: 4px; background: #f1f5f9;
  padding: 4px; border-radius: 10px; user-select: none;
}
.tab {
  padding: 6px 14px; border: none; background: none;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  border-radius: 8px; cursor: pointer; transition: all 0.2s;
}
.tab.active {
  background: white; color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.view-all {
  font-size: 13px; color: var(--primary);
  text-decoration: none; font-weight: 500;
}
.view-all:hover { text-decoration: underline; }

/* ===== 图表区域 ===== */
.chart-area { margin-bottom: 16px; }
.chart-area canvas { width: 100%; height: 220px; }

.chart-legend { display: flex; gap: 20px; justify-content: center; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.legend-line { width: 16px; height: 2px; border-radius: 1px; }

/* ===== 记录列表 ===== */
.records-list { display: flex; flex-direction: column; gap: 12px; }
.record-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; border-radius: 12px; background: #f8fafc;
  transition: all 0.2s; cursor: pointer; user-select: none;
}
.record-item:hover { background: #f1f5f9; transform: translateX(4px); }
.record-item-other { border-left: 3px solid #8b5cf6; }
.record-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
}
.record-icon.fuel { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.record-icon.ev { background: linear-gradient(135deg, #10b981, #34d399); }
.record-icon.other { background: linear-gradient(135deg, #8b5cf6, #a855f7); }
.record-info { flex: 1; }
.record-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.record-meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--text-secondary); }
.tag { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.tag-fuel { background: rgba(99,102,241,0.1); color: var(--primary); }
.tag-ev { background: rgba(16,185,129,0.1); color: var(--success); }
.tag-other { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.unit-price { font-size: 11px; color: var(--text-muted); background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }
.record-right { text-align: right; }
.record-date { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.record-efficiency { font-size: 13px; font-weight: 600; color: var(--success); }

.btn-add {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: white;
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-add:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 车辆卡片 ===== */
.vehicle-card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px; border-radius: 14px; background: #f8fafc;
  margin-bottom: 12px; border: 2px solid transparent;
  transition: all 0.2s; cursor: pointer; position: relative; user-select: none;
}
.vehicle-card:hover { background: #f1f5f9; }
.vehicle-card.active { border-color: var(--primary); background: rgba(99,102,241,0.04); }
.vehicle-img { width: 100px; height: 60px; flex-shrink: 0; }
.vehicle-img svg { width: 100%; height: 100%; }
.vehicle-details { flex: 1; }
.vehicle-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.vehicle-plate { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.vehicle-stats { display: flex; gap: 20px; }
.v-stat { display: flex; flex-direction: column; gap: 2px; }
.v-label { font-size: 11px; color: var(--text-muted); }
.v-value { font-size: 13px; font-weight: 600; color: #374151; }
.vehicle-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; background: var(--primary);
  color: white; border-radius: 6px;
}

/* ===== 费用构成 ===== */
.cost-content { display: flex; align-items: center; gap: 20px; }
.cost-content canvas { width: 160px !important; height: 160px !important; flex-shrink: 0; }
.cost-legend { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.cost-item { display: flex; align-items: center; gap: 10px; }
.cost-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.cost-name { font-size: 13px; color: #374151; flex: 1; }
.cost-value { font-size: 13px; font-weight: 600; color: var(--text); }

/* ===== 补能统计 ===== */
.types-panel .types-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.type-box { padding: 14px; border-radius: 12px; background: #f8fafc; text-align: center; }
.type-box .type-num { font-size: 22px; font-weight: 700; }
.type-box .type-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== 登录遮罩 ===== */
.auth-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.auth-card {
  background: white; border-radius: 20px; padding: 36px;
  width: 380px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.auth-card h2 { text-align: center; margin-bottom: 8px; font-size: 20px; }
.auth-card .subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; outline: none; transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

.btn-login {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; user-select: none;
}
.btn-login:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-error { color: var(--danger); font-size: 13px; text-align: center; margin-top: 12px; min-height: 20px; }

/* ===== 加载状态 ===== */
.loading-wrap { text-align: center; padding: 80px 0; color: var(--text-muted); }
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-state p { margin-top: 8px; font-size: 14px; }

/* ===== 响应式 ===== */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-row { grid-template-columns: 1fr; }
  .content-row:last-child { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .nav-links { display: none; }
  .main-content { padding: 16px; }
  .welcome-banner { flex-direction: column; gap: 16px; text-align: center; }
  .stats-grid { grid-template-columns: 1fr; }
  .vehicle-selector select { max-width: 100px; }
  .content-row:last-child { grid-template-columns: 1fr; }
}

/* ===== 新增补能弹窗 ===== */
.record-modal-overlay {
  perspective: 800px;
  position: fixed; inset: 0; background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; animation: overlayIn 0.3s ease-out;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.record-modal {
  transform-origin: var(--genie-x, 50%) var(--genie-y, 50%);
  background: white; border-radius: 20px; width: 520px; max-width: 94vw;
  max-height: 90vh; overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  box-shadow: 0 25px 80px rgba(0,0,0,0.25);
  animation: genieZoom 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes genieZoom {



  0%   { opacity: 0; transform: perspective(800px) scaleY(0.1) scaleX(0.4) rotateX(12deg); }

@keyframes genieZoomOut {
  0%   { opacity: 1; transform: perspective(800px) scaleY(1) scaleX(1) rotateX(0deg); }
  100% { opacity: 0; transform: perspective(800px) scaleY(0.1) scaleX(0.4) rotateX(12deg); }
}



  100% { opacity: 1; transform: perspective(800px) scaleY(1) scaleX(1) rotateX(0deg); }



}



.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 0;
}
.modal-header h3 { font-size: 18px; font-weight: 700; color: var(--text); }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: white; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 18px; transition: all 0.2s;
}
.modal-close:hover { border-color: var(--danger); color: var(--danger); }

.modal-body { padding: 20px 28px 28px; }

/* 类型切换 */
.type-toggle {
  display: flex; gap: 6px; background: #f1f5f9;
  padding: 4px; border-radius: 12px; margin-bottom: 20px;
}
.type-toggle .type-opt {
  flex: 1; padding: 10px; border: none; background: none;
  border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.type-toggle .type-opt.active {
  background: white; color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 表单行 */
.form-row { display: flex; gap: 12px; margin-bottom: 14px; }
.form-field { flex: 1; }
.form-field label {
  display: block; font-size: 13px; font-weight: 500;
  color: #374151; margin-bottom: 6px;
}
.form-field label .hint { font-weight: 400; color: var(--text-muted); font-size: 11px; }
.form-field input, .form-field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; outline: none;
  transition: border-color 0.2s; background: white; color: var(--text);
}
.form-field input:focus, .form-field select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.form-field input:disabled { background: #f8fafc; color: var(--text-muted); cursor: not-allowed; }

/* 工况选择 */
.road-toggle {
  display: flex; gap: 8px; margin-top: 2px;
}
.road-opt {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 8px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; cursor: pointer; transition: all 0.2s; background: white;
  color: var(--text-secondary);
}
.road-opt.active { border-color: var(--primary); background: rgba(99,102,241,0.06); color: var(--primary); font-weight: 600; }

/* 百分比快速选择 */
.pct-presets { display: flex; gap: 4px; margin-top: 4px; }
.pct-preset {
  padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 11px; cursor: pointer; background: white; color: var(--text-secondary);
  transition: all 0.15s;
}
.pct-preset:hover { border-color: var(--primary); color: var(--primary); }

/* 操作后字段分组 */
.after-group {
  background: #f8fafc; border-radius: 12px; padding: 14px;
  margin-bottom: 14px;
}

.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding-top: 8px;
}
.btn-cancel {
  padding: 10px 20px; border: 1px solid var(--border); background: white;
  border-radius: 10px; font-size: 14px; font-weight: 500; cursor: pointer;
  color: var(--text-secondary); transition: all 0.2s;
}
.btn-cancel:hover { border-color: var(--text-secondary); }
.btn-submit {
  padding: 10px 24px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.btn-submit:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.form-error {
  color: var(--danger); font-size: 13px; min-height: 20px;
  margin-top: 6px; text-align: center;
}

/* 隐藏弹窗滚动条 */
.record-modal::-webkit-scrollbar { display: none; }

/* ==================== 全部记录弹窗 ==================== */
.all-records-modal { width: 620px; }
.all-records-list { max-height: 55vh; overflow-y: auto; }
.all-records-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.2s;
}
.all-records-item:hover { background: #f1f5f9; }
.all-records-item:last-child { border-bottom: none; }
.ari-left { display: flex; flex-direction: column; gap: 2px; }
.ari-type { font-size: 13px; font-weight: 600; color: var(--text); }
.ari-amount { font-size: 12px; color: var(--text-muted); }
.ari-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.ari-mileage { font-size: 13px; font-weight: 600; color: var(--text); }
.ari-money { font-size: 12px; color: #6366f1; font-weight: 600; }
.ari-date { font-size: 11px; color: var(--text-muted); }

.btn-delete {
  background: none; border: 1px solid #fca5a5; color: #dc2626;
  padding: 10px 18px; border-radius: 10px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-delete:hover { background: #fef2f2; border-color: #dc2626; }
