/* ============================================================
   停车查询 v2 — 设计系统
   令牌驱动 · 亮/暗自适应 · 移动优先
   ============================================================ */

:root {
  --primary: #1a73e8;
  --primary-strong: #1558b0;
  --primary-soft: #e8f0fe;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #6d28d9;
  --info-soft: #ede9fe;

  --bg: #f2f5f9;
  --bg-accent: radial-gradient(1200px 400px at 50% -100px, #dbe7fb 0%, rgba(219, 231, 251, 0) 70%);
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #1f2937;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 4px 8px rgba(15, 23, 42, 0.08), 0 12px 32px rgba(15, 23, 42, 0.12);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #5b9bf5;
    --primary-strong: #7fb0f7;
    --primary-soft: #1e3a5f;
    --accent: #2dd4bf;
    --accent-soft: #134e4a;
    --ok: #4ade80;
    --ok-soft: #14532d;
    --warn: #fbbf24;
    --warn-soft: #713f12;
    --danger: #f87171;
    --danger-soft: #7f1d1d;
    --info: #a78bfa;
    --info-soft: #4c1d95;

    --bg: #0b1220;
    --bg-accent: radial-gradient(1200px 400px at 50% -100px, #14263f 0%, rgba(20, 38, 63, 0) 70%);
    --surface: #141d2e;
    --surface-2: #1a2438;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #263349;
    --border-strong: #37475f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

/* ---------- 基础 ---------- */

* {
  box-sizing: border-box;
}

/* author 样式（display:flex 等）不得压过 hidden 属性 */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-accent);
  background-repeat: no-repeat;
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.container.wide {
  max-width: 980px;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 13px;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- 顶栏 ---------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.appbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #2b7cff, #144f9e);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 6px rgba(26, 115, 232, 0.35);
}

.brand-mark.big {
  width: 52px;
  height: 52px;
  font-size: 26px;
  border-radius: 14px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 16px;
}

.db-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
  flex: none;
}

.db-status.ok .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent);
}

.db-status.bad .dot {
  background: var(--danger);
}

/* 用户菜单 */

.menu {
  position: relative;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.user-chip:hover {
  border-color: var(--border-strong);
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  flex: none;
}

.caret {
  color: var(--text-muted);
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
}

.menu-header {
  padding: 8px 10px 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.menu-item.danger {
  color: var(--danger);
}

.menu-sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 6px 4px;
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.card.inner {
  box-shadow: none;
  background: var(--surface-2);
}

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

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.card-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, opacity 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--primary);
}

.btn-ghost:hover {
  background: var(--primary-soft);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 7px;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 15px;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
}

.btn .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn:not(.btn-primary):not(.btn-danger):not(.btn-accent) .spinner {
  border-color: color-mix(in srgb, var(--text) 25%, transparent);
  border-top-color: var(--text);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 表单 ---------- */

.field {
  display: block;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.field > .input {
  margin-top: 6px;
  font-weight: 400;
}

.input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

textarea.input {
  resize: vertical;
  min-height: 88px;
}

select.input {
  appearance: auto;
}

.input-lg {
  padding: 13px 14px;
  font-size: 17px;
}

.field-hint {
  margin: -6px 0 12px;
  font-size: 12.5px;
  color: var(--warn);
}

.form-msg {
  min-height: 20px;
  margin: 4px 0 10px;
  font-size: 13.5px;
  color: var(--danger);
}

.form-msg.ok {
  color: var(--ok);
}

.field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

.agree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 400;
  margin-bottom: 12px;
}

.agree-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* ---------- 标签 / 徽标 ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.tag.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}

.tag.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}

.tag.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.tag.info {
  background: var(--info-soft);
  color: var(--info);
  border-color: transparent;
}

.tag.primary {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}

/* 车牌徽标（仿真牌面） */

.plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border-radius: 9px;
  background: linear-gradient(180deg, #2f83ff, #175fd9);
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(23, 95, 217, 0.35);
  color: #fff;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

.plate.sm {
  padding: 3px 10px;
  font-size: 15px;
  letter-spacing: 1px;
}

/* ---------- 提示条 ---------- */

.banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  margin-bottom: 16px;
  font-size: 14.5px;
}

.banner b {
  font-size: 15px;
}

.banner p {
  margin: 0;
  color: var(--text-muted);
}

.banner.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.banner.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.banner.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.banner.info {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ---------- 键值对 ---------- */

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 18px;
  margin: 0;
}

.kv dt {
  color: var(--text-muted);
  font-size: 13.5px;
  white-space: nowrap;
}

.kv dd {
  margin: 0;
  font-size: 14.5px;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

/* ---------- 费用 ---------- */

.fee-amount {
  margin: 6px 0 2px;
  font-size: 40px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.fee-amount.sm {
  font-size: 22px;
}

.fee-note {
  margin: 2px 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.live-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- 表格 ---------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 520px;
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.table th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table .actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------- 分段控件 ---------- */

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow);
}

/* ---------- 统计卡 ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.stat-card .num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-card .label {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------- 骨架屏 ---------- */

.skeleton-card {
  height: 132px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    100deg,
    var(--surface) 40%,
    color-mix(in srgb, var(--surface) 55%, var(--border)) 50%,
    var(--surface) 60%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

@keyframes shimmer {
  to {
    background-position-x: -200%;
  }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  background: #111827;
  color: #f9fafb;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: 86vw;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Dialog ---------- */

dialog.dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(92vw, 460px);
  width: 100%;
}

dialog.dialog::backdrop {
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(2px);
}

.dialog-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  margin: 0;
}

.dialog-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
}

.dialog-message {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 14.5px;
  word-break: break-word;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* ---------- 空状态 ---------- */

.empty {
  text-align: center;
  padding: 42px 16px;
  color: var(--text-muted);
}

.empty .empty-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}

/* ---------- 过滤行 ---------- */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-actions {
  margin-top: 14px;
}

/* ---------- 搜索 / 会员卡 ---------- */

.search-row {
  display: flex;
  gap: 10px;
}

.search-row .input {
  flex: 1;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- 公告列表 ---------- */

.ad-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}

.ad-row:last-child {
  border-bottom: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}

.ad-row:hover {
  background: var(--surface-2);
}

.ad-row .ad-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 认证页 ---------- */

.auth-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-wrap {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  margin-bottom: 14px;
}

.auth-head {
  text-align: center;
  margin-bottom: 18px;
}

.auth-head h1 {
  margin: 12px 0 2px;
  font-size: 21px;
}

.auth-head p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.captcha-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.captcha-row .input {
  flex: 1;
  margin-top: 0;
}

.captcha-row img {
  width: 132px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  flex: none;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 14px;
}

.auth-copy {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------- 注册须知 ---------- */

.notice h3 {
  margin: 16px 0 4px;
  font-size: 15px;
}

.notice p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* ---------- 页签 ---------- */

.tabbar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab {
  border: 0;
  background: none;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ---------- 页脚 ---------- */

.footer {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  padding-top: 12px;
}

/* ---------- 车牌识别 ---------- */

.plate-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.plate-pick:hover {
  background: var(--surface-2);
  border-color: var(--primary);
}

/* ---------- 响应式 ---------- */

@media (max-width: 560px) {
  .fee-amount {
    font-size: 34px;
  }

  .stat-card .num {
    font-size: 24px;
  }

  .search-row {
    flex-direction: column;
  }

  .kv {
    grid-template-columns: auto 1fr;
    gap: 8px 14px;
  }

  .user-name {
    display: none;
  }

  .user-chip {
    padding: 4px;
  }
}

/* ---------- 降低动效 ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
