:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }

.container { max-width: 880px; margin: 0 auto; padding: 24px 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.page-title {
  margin: 0 0 20px;
  font-size: 22px;
  font-weight: 700;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #eef2ff; color: var(--primary); }
.btn-ghost:hover { background: #e0e7ff; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 6px; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.form-group .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border 0.15s, box-shadow 0.15s;
  background: #fff;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.input-sm { width: 80px; padding: 6px 8px; font-size: 14px; }

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: var(--primary); border: 1px solid #bfdbfe; }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td.qr-cell { text-align: center; }
td.qr-cell img {
  width: 92px;
  height: 92px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.empty-sm { text-align: center; color: var(--muted); padding: 16px 0; font-size: 14px; }

/* 扫码页 */
.scan-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #eef2ff 0%, #f4f6fb 100%);
}
.scan-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(37, 99, 235, 0.12);
}
.scan-card .logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}
.scan-card h1 {
  font-size: 20px;
  margin: 0 0 6px;
}
.scan-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.scan-card .owner-name { font-weight: 700; color: var(--primary); }
.call-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.call-btn:hover { background: var(--primary-dark); }
.call-btn:active { transform: translateY(1px); }
.call-btn:disabled { background: #9ca3af; cursor: default; }
.scan-card .privacy {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.scan-card .status { margin-top: 14px; font-size: 13px; color: var(--muted); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #eef2ff 0%, #f4f6fb 100%);
}
.login-card { width: 100%; max-width: 360px; }

.back-link {
  margin-top: 14px;
  text-align: center;
  font-size: 14px;
}
.back-link a { color: var(--muted); }
.back-link a:hover { color: var(--primary); }

/* 首页 */
.landing-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #eef2ff 0%, #f4f6fb 100%);
}
.landing-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 18px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(37, 99, 235, 0.12);
}
.landing-card .logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}
.landing-card h1 { font-size: 22px; margin: 0 0 6px; }
.landing-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.landing-actions { display: flex; flex-direction: column; gap: 10px; }

/* 注册成功页 */
.success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
}
.info-text {
  margin: 16px 0;
  padding: 12px 16px;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 14px;
}
.info-text p { margin: 4px 0; }

/* 密码展示 */
.password-card {
  margin: 16px 0;
  padding: 20px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.password-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.password-value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 4px;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
}
.password-highlight {
  color: var(--primary);
  background: #eff6ff;
  padding: 8px 12px;
  border-radius: 6px;
  display: inline-block;
}

/* 管理后台 Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab:hover:not(.active) { background: #f0f4ff; }
.tab .badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}
.tab.active .badge { background: rgba(255,255,255,0.3); }
.tab-action { margin-left: auto; }

/* 管理后台 - 车主块 */
.owner-block {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.owner-block:last-child { border-bottom: none; }
.owner-block:first-child { padding-top: 0; }
.owner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.owner-block .owner-name { font-size: 16px; font-weight: 700; }
.owner-block .owner-phone { color: var(--muted); margin-left: 8px; font-size: 14px; }
.quota-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: #eff6ff;
  color: var(--primary);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.quota-form {
  margin-bottom: 12px;
}

/* 车主后台 - 信息卡 */
.owner-info-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.owner-info .owner-name { font-size: 18px; font-weight: 700; }
.owner-info .owner-phone { color: var(--muted); margin-left: 8px; }
.quota-info { font-size: 14px; color: var(--muted); }

/* 车主后台 - 二维码卡片网格 */
.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.qr-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.qr-card-img img {
  width: 100%;
  max-width: 200px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.qr-card-plate {
  font-size: 16px;
  font-weight: 700;
  margin-top: 12px;
}
.qr-card-stat { font-size: 13px; color: var(--muted); margin-top: 4px; }
.qr-card-actions {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.qr-card-date { font-size: 12px; color: var(--muted); margin-top: 8px; }
