/* ============================================================
   摩研云后台 · MotoECU Pro 运营管理站
   现代深色 SaaS 主题：深空底色 / 青蓝渐变 / 精细层次
   ============================================================ */

:root {
  --bg: #0a0f1a;
  --bg-soft: #0d1422;
  --panel: #111a2c;
  --panel-2: #0e1626;
  --panel-hover: #152036;
  --line: rgba(148, 178, 220, 0.13);
  --line-strong: rgba(148, 178, 220, 0.22);
  --text: #e6eefb;
  --muted: #8ba0bd;
  --faint: #5e7290;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-grad: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  --ok: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 28px rgba(2, 6, 16, 0.45);
  --shadow-lg: 0 20px 60px rgba(2, 6, 16, 0.6);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(56, 189, 248, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(129, 140, 248, 0.07), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: #7dd3fc; }

::selection { background: rgba(56, 189, 248, 0.3); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(139, 160, 189, 0.25);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(139, 160, 189, 0.45); }

/* ---------- 布局骨架 ---------- */

.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0c1322 0%, #0a101c 100%);
  border-right: 1px solid var(--line);
  padding: 22px 14px 18px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: var(--accent-grad);
  display: grid;
  place-items: center;
  color: #071120;
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.35);
}

.brand-logo svg { width: 21px; height: 21px; }

.brand-name { font-size: 17px; font-weight: 800; letter-spacing: .3px; }
.brand-sub { color: var(--faint); font-size: 11.5px; margin: 1px 0 0; letter-spacing: .4px; }

.nav { margin-top: 26px; flex: 1; }

.group { margin-bottom: 22px; }
.group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--faint);
  padding: 0 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  margin-bottom: 3px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.8px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  position: relative;
}

.nav a svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .8; }

.nav a:hover {
  background: rgba(148, 178, 220, 0.07);
  color: var(--text);
}

.nav a.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(129, 140, 248, 0.12));
  border-color: rgba(56, 189, 248, 0.28);
  color: #fff;
  font-weight: 600;
}

.nav a.active svg { opacity: 1; color: var(--accent); }

.nav a.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-grad);
}

.nav-divider { height: 1px; background: var(--line); margin: 14px 8px; }

.nav a.logout { color: var(--faint); }
.nav a.logout:hover { color: var(--bad); background: rgba(248, 113, 113, 0.08); }

.side-foot {
  padding: 12px 12px 0;
  border-top: 1px solid var(--line);
  margin-top: 10px;
  color: var(--faint);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px rgba(52, 211, 153, .8); }

.main { padding: 0 0 40px; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 34px;
  background: rgba(10, 15, 26, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.crumb { color: var(--faint); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.crumb b { color: var(--muted); font-weight: 600; }
.crumb svg { width: 13px; height: 13px; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ok);
  background: rgba(52, 211, 153, 0.09);
  border: 1px solid rgba(52, 211, 153, 0.25);
  padding: 4px 11px;
  border-radius: 999px;
  font-weight: 600;
}

.content { padding: 30px 34px 0; max-width: 1460px; }

/* ---------- 页头 ---------- */

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 24px;
}

h1 { margin: 0; font-size: 25px; font-weight: 800; letter-spacing: .2px; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-top: 5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 9px;
}
h2::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--accent-grad);
}

h3 { font-size: 15.5px; font-weight: 700; }

/* ---------- 统计卡片 ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  position: relative;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--accent-grad);
  opacity: .55;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.card .label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card .label svg { width: 15px; height: 15px; color: var(--accent); }

.card .value {
  font-size: 30px;
  font-weight: 800;
  margin-top: 10px;
  letter-spacing: .3px;
  font-variant-numeric: tabular-nums;
}

.card .hint { color: var(--faint); font-size: 12px; margin-top: 4px; }

/* ---------- 面板 / 表格 ---------- */

.panel {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(2, 6, 16, 0.25);
}

.panel > table { margin: 0 -6px; width: calc(100% + 12px); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--faint);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr { transition: background .12s ease; }
tbody tr:hover { background: rgba(148, 178, 220, 0.05); }
tbody tr:last-child td { border-bottom: none; }

td.mono, .mono {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

td .sub { color: var(--faint); font-size: 12px; }

/* ---------- 徽章 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}

.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.badge.ok { background: rgba(52, 211, 153, 0.1); color: var(--ok); border: 1px solid rgba(52, 211, 153, 0.3); }
.badge.bad { background: rgba(248, 113, 113, 0.1); color: var(--bad); border: 1px solid rgba(248, 113, 113, 0.3); }
.badge.warn { background: rgba(251, 191, 36, 0.1); color: var(--warn); border: 1px solid rgba(251, 191, 36, 0.3); }
.badge.info { background: rgba(56, 189, 248, 0.1); color: var(--accent); border: 1px solid rgba(56, 189, 248, 0.3); }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  background: rgba(148, 178, 220, 0.08);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1.2;
}

.btn:hover { background: rgba(148, 178, 220, 0.14); border-color: rgba(148, 178, 220, 0.32); }

.btn.primary {
  background: var(--accent-grad);
  border: none;
  color: #071120;
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.28);
}

.btn.primary:hover { filter: brightness(1.1); box-shadow: 0 8px 22px rgba(56, 189, 248, 0.38); }

.btn.danger { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.35); color: var(--bad); }
.btn.danger:hover { background: rgba(248, 113, 113, 0.18); }

.btn.small { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }

.btn:active { transform: translateY(1px); }

/* ---------- 表单 ---------- */

input, textarea, select {
  width: 100%;
  background: #0b1424;
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: var(--font);
  transition: border-color .15s ease, box-shadow .15s ease;
}

input::placeholder, textarea::placeholder { color: var(--faint); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238ba0bd' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

label { display: block; margin: 0 0 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; }
.row .field { flex: 1; min-width: 160px; }

.form label { display: block; margin-bottom: 14px; }
.form label input, .form label select { margin-top: 5px; }

/* ---------- 提示条 ---------- */

.alert {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid transparent;
}

.alert.ok { background: rgba(52, 211, 153, 0.08); border-color: rgba(52, 211, 153, 0.28); color: var(--ok); }
.alert.bad { background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.28); color: var(--bad); }
.alert.warn { background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.28); color: var(--warn); }

/* ---------- 行内操作区 ---------- */

td.actions { white-space: nowrap; }
td.actions .inline { display: inline-flex; gap: 6px; align-items: center; margin-right: 6px; }
td.actions input[type="text"], td.actions input[type="number"] { width: 96px; padding: 5px 9px; font-size: 12.5px; }

/* ---------- 空状态 ---------- */

tbody td[colspan] {
  text-align: center;
  color: var(--faint);
  padding: 34px 10px;
  font-size: 13px;
}

/* ---------- 登录页 ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 480px at 78% 12%, rgba(56, 189, 248, 0.13), transparent 55%),
    radial-gradient(720px 420px at 15% 88%, rgba(129, 140, 248, 0.12), transparent 55%),
    #070c16;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 178, 220, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 178, 220, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: min(430px, 94vw);
  background: rgba(17, 26, 44, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 38px 36px 32px;
  box-shadow: var(--shadow-lg);
  animation: rise .5s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 8px; }
.login-brand .brand-logo { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 13px; }
.login-brand .brand-logo svg { width: 24px; height: 24px; }
.login-card h1 { font-size: 23px; margin: 0; }
.login-card .page-sub { margin: 2px 0 26px; }

.login-card .btn.primary { width: 100%; padding: 11px 16px; font-size: 14.5px; margin-top: 6px; }

.login-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1180px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 12px 14px;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    gap: 10px;
  }
  .brand { padding: 0; flex: 0 0 auto; }
  .brand-sub, .side-foot, .group-label, .nav-divider { display: none; }
  .nav { margin: 0; display: flex; gap: 4px; flex: 0 0 auto; }
  .group { margin: 0; display: flex; gap: 4px; }
  .nav a { margin: 0; white-space: nowrap; padding: 7px 11px; }
  .nav a.active::before { display: none; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .top { flex-direction: column; align-items: flex-start; }
}