/* ==========================================================================
   优选二手车 · 共享样式
   ========================================================================== */

:root {
  --ink: #0d1524;
  --ink-2: #1c2637;
  --ink-3: #5a6679;
  --ink-4: #8b96a8;
  --line: #e6e9ef;
  --line-2: #f0f2f6;
  --bg: #f6f7f9;
  --card: #ffffff;
  --brand: #1450d6;
  --brand-dark: #0f3ba6;
  --brand-soft: #eef3ff;
  --accent: #ff6a1f;
  --accent-soft: #fff2ea;
  --ok: #0d9f6e;
  --ok-soft: #e8f8f2;
  --warn: #d18a00;
  --warn-soft: #fff7e6;
  --danger: #e0342b;
  --danger-soft: #fdeceb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(13, 21, 36, .05), 0 2px 8px rgba(13, 21, 36, .04);
  --shadow-2: 0 8px 24px rgba(13, 21, 36, .10);
  --shadow-3: 0 18px 48px rgba(13, 21, 36, .16);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --num: "SF Mono", "DIN Alternate", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.hide { display: none !important; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
}
.logo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #2f7bff 70%, #58a0ff);
  color: #fff;
  display: grid; place-items: center;
  font-size: 17px;
  font-weight: 800;
  flex: none;
  box-shadow: 0 4px 12px rgba(20, 80, 214, .28);
}
.logo-text { min-width: 0; }
.logo-name {
  font-size: 16px; font-weight: 800; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.logo-sub { font-size: 11px; color: var(--ink-4); letter-spacing: .04em; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink-2);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s, transform .1s, box-shadow .16s;
}
.btn:hover { border-color: #cfd6e2; background: #fbfcfe; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #1a5ce8, var(--brand));
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(20, 80, 214, .24);
}
.btn-primary:hover { background: linear-gradient(180deg, #1755d8, var(--brand-dark)); border-color: var(--brand-dark); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #f25c10; border-color: #f25c10; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; color: var(--ink); }
.btn-danger { background: #fff; border-color: #f4c8c5; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #eeb1ad; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- 表单 */
.field { margin-bottom: 14px; }
.label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
}
.label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 80, 214, .12);
}
.input::placeholder, .textarea::placeholder { color: #a9b2c1; }
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a6679' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.hint { margin-top: 5px; font-size: 11.5px; color: var(--ink-4); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid2-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
@media (max-width: 640px) { .grid2, .grid2-3 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- 标签 */
.tag {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: 6px;
  background: var(--line-2);
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.tag-brand { background: var(--brand-soft); color: var(--brand); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-ghost { background: #f1f3f7; color: var(--ink-4); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: 15px; }
.card-head .sub { font-size: 12px; color: var(--ink-4); font-weight: 500; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }

/* ---------------------------------------------------------------- 空态 / 加载 */
.empty { padding: 56px 20px; text-align: center; color: var(--ink-4); }
.empty-ico { font-size: 34px; margin-bottom: 10px; opacity: .5; }
.empty-t { font-size: 14px; font-weight: 600; color: var(--ink-3); }
.empty-s { font-size: 12.5px; margin-top: 4px; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-dark { border-color: rgba(13,21,36,.15); border-top-color: var(--ink-3); }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton {
  background: linear-gradient(90deg, #eef0f4 25%, #f6f7f9 37%, #eef0f4 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------------------------------------------------------------- 提示条 */
.toast-host {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 420px;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px;
  border-radius: 11px;
  background: rgba(13, 21, 36, .94);
  color: #fff;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-3);
  animation: toast-in .22s cubic-bezier(.2, .9, .3, 1.2);
  max-width: 100%;
}
.toast-ok { background: rgba(9, 122, 84, .96); }
.toast-err { background: rgba(196, 38, 31, .96); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }

/* ---------------------------------------------------------------- 弹层 */
.mask {
  position: fixed; inset: 0;
  z-index: 100;
  background: rgba(13, 21, 36, .5);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade .18s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 460px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: pop .24s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.modal-head { padding: 18px 20px 0; }
.modal-head h3 { font-size: 17px; }
.modal-head p { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); }
.modal-body { padding: 18px 20px; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 0 20px 20px;
}

/* ---------------------------------------------------------------- 分段控件 */
.seg {
  display: inline-flex;
  padding: 3px;
  background: #eef0f4;
  border-radius: 10px;
  gap: 2px;
}
.seg button {
  border: 0; background: transparent;
  height: 30px; padding: 0 14px;
  border-radius: 8px;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, color .16s, box-shadow .16s;
}
.seg button.on {
  background: #fff; color: var(--ink);
  box-shadow: 0 1px 3px rgba(13, 21, 36, .12);
}

/* ---------------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 720px; }
table.tbl th {
  position: sticky; top: 0;
  padding: 11px 12px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px; font-weight: 700;
  color: var(--ink-3);
  white-space: nowrap;
}
table.tbl td {
  padding: 12px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
  vertical-align: middle;
}
table.tbl tbody tr:hover { background: #fafbfd; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
.row-thumb {
  width: 64px; height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--line-2);
  flex: none;
}
.row-thumb-ph {
  width: 64px; height: 48px;
  border-radius: 8px;
  background: var(--line-2);
  display: grid; place-items: center;
  color: #b6bec9; font-size: 16px;
  flex: none;
}
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------------------------------------------------------------- 页脚 */
.footer {
  margin-top: 40px;
  padding: 24px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--ink-4);
  font-size: 12px;
  text-align: center;
}
.footer a { color: var(--ink-4); }
.footer a:hover { color: var(--brand); }
