/* ============ 安心到家 · 设计系统 ============ */
:root {
  --brand: #2f6bff;
  --brand-600: #1f56e0;
  --brand-50: #eef4ff;
  --brand-100: #dbe6ff;
  --accent: #ff9f1a;
  --success: #12b76a;
  --success-bg: #e7f8f0;
  --warning: #f79009;
  --warning-bg: #fff7e8;
  --danger: #f04438;
  --danger-bg: #fef0ef;
  --purple: #7a5af8;
  --purple-bg: #f2efff;
  --cyan: #06aed4;
  --cyan-bg: #e6f8fc;
  --ink: #101828;
  --ink-2: #344054;
  --ink-3: #667085;
  --ink-4: #98a2b3;
  --line: #eaecf0;
  --line-strong: #d0d5dd;
  --bg: #f4f6fb;
  --card: #ffffff;
  --sidebar: #0d1526;
  --sidebar-2: #111d33;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: var(--font); }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd6e3; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.card-title .sub { font-size: 12px; font-weight: 400; color: var(--ink-4); }
.card-body { padding: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink-2);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: all .16s ease;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(47, 107, 255, .24); }
.btn-primary:hover { background: var(--brand-600); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { color: #fff; filter: brightness(.95); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { color: #fff; filter: brightness(.95); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: var(--bg); color: var(--brand); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-lg { height: 44px; font-size: 15px; padding: 0 22px; border-radius: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.st-pending_door_fee { background: #f2f4f7; color: #667085; }
.st-pending_dispatch { background: #fff4e5; color: #b54708; }
.st-dispatched { background: #eaf1ff; color: #1f56e0; }
.st-accepted { background: #e6f8fc; color: #0b7c93; }
.st-departed { background: #eef0ff; color: #4a56c9; }
.st-checked_in { background: #f4ecff; color: #6d3bd1; }
.st-pending_quote_confirm { background: #fff7e6; color: #b76e00; }
.st-repairing { background: #eaf1ff; color: #1f56e0; }
.st-pending_acceptance { background: #e5f9f2; color: #067647; }
.st-completed { background: #e7f8f0; color: #067647; }
.st-cancelled { background: #f2f4f7; color: #667085; }
.st-refunding { background: #fef0ef; color: #b42318; }
.st-rework { background: #f2efff; color: #5b3dd6; }
.st-approved, .st-settled, .st-paid { background: var(--success-bg); color: #067647; }
.st-pending { background: var(--warning-bg); color: #b54708; }
.st-rejected, .st-failed { background: var(--danger-bg); color: #b42318; }
.st-open { background: var(--danger-bg); color: #b42318; }
.st-following { background: var(--warning-bg); color: #b54708; }
.st-closed { background: #f2f4f7; color: #475467; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 6px; background: var(--brand-50); color: var(--brand-600);
  font-size: 12px; font-weight: 500;
}
.tag-warn { background: var(--warning-bg); color: #b54708; }
.tag-danger { background: var(--danger-bg); color: #b42318; }
.tag-success { background: var(--success-bg); color: #067647; }
.tag-gray { background: #f2f4f7; color: var(--ink-3); }
.tag-purple { background: var(--purple-bg); color: #5b3dd6; }
.tag-blue { background: #eef4ff; color: #1f56e0; }

.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); font-size: 13px; font-family: var(--font);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 107, 255, .12); }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-4); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.required { color: var(--danger); margin-left: 2px; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #d0d5dd; border-radius: 999px; cursor: pointer; transition: .2s; }
.switch .slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(16px); }

.table-wrap { width: 100%; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 14px; color: var(--ink-3); font-weight: 600; font-size: 12px;
  background: #f9fafb; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; }
.table tbody tr:hover td { background: #fafbfe; }
.table tbody tr:last-child td { border-bottom: none; }
.table .mono { font-family: "SF Mono", Consolas, monospace; font-size: 12px; color: var(--ink-3); }
.table .strong { font-weight: 600; color: var(--ink); }
.table .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.table .actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--ink-3); }
.text-xs { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.money-plus { color: var(--success); }
.money-minus { color: var(--danger); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  border: none; background: transparent; padding: 12px 14px; font-size: 13px; font-weight: 600;
  color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs.pill { border-bottom: none; gap: 6px; background: #f2f4f7; padding: 3px; border-radius: 10px; display: inline-flex; }
.tabs.pill button { padding: 7px 14px; border-radius: 8px; border-bottom: none; margin: 0; font-size: 12px; }
.tabs.pill button.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(16,24,40,.1); }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 48px 20px; color: var(--ink-4); font-size: 13px; }
.empty svg { width: 44px; height: 44px; opacity: .4; }

.pagination { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 14px 20px; }
.pagination .page-info { font-size: 12px; color: var(--ink-3); margin-right: 6px; }
.page-btn { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 12px; cursor: pointer; }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #6f9bff, #2f6bff); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }

/* ---------- 弹窗 / 抽屉 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 900;
  opacity: 0; pointer-events: none; transition: opacity .2s;
  backdrop-filter: blur(2px);
}
.overlay.show { opacity: 1; pointer-events: auto; }

.modal {
  position: fixed; z-index: 950; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(.98);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 80px);
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden;
  transition: transform .2s, opacity .2s; opacity: 0;
}
.modal.show { display: flex; transform: translate(-50%, -50%) scale(1); opacity: 1; }
.modal-head { padding: 20px 24px 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-head .desc { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.modal-body { padding: 4px 24px 10px; overflow-y: auto; }
.modal-foot { padding: 16px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { width: 30px; height: 30px; border-radius: 8px; border: none; background: #f2f4f7; color: var(--ink-3); cursor: pointer; font-size: 16px; line-height: 1; flex: none; }
.modal-close:hover { background: #e4e7ec; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 950; width: min(760px, 96vw);
  background: #fff; box-shadow: -12px 0 40px rgba(16,24,40,.16);
  transform: translateX(103%); transition: transform .26s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer-head { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex: none; }
.drawer-head h3 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 40px; background: #fbfcfe; }
.drawer-foot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fff; flex: none; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 1200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px;
  background: #101828; color: #fff; font-size: 13px; box-shadow: var(--shadow-lg);
  animation: toastIn .22s ease both;
}
.toast.success { background: #05603a; }
.toast.error { background: #912018; }
.toast.info { background: #101828; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 图表 ---------- */
.chart-box { width: 100%; position: relative; }
.chart-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.legend { display: flex; flex-direction: column; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.legend-dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.legend-item b { color: var(--ink); font-weight: 600; margin-left: auto; font-variant-numeric: tabular-nums; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.kpi .label { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 26px; font-weight: 750; letter-spacing: -.4px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.kpi .foot { font-size: 12px; color: var(--ink-4); display: flex; align-items: center; gap: 6px; }
.kpi .ico { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-50); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.kpi .ico svg { width: 17px; height: 17px; }
.kpi.warn .ico { background: var(--warning-bg); color: var(--warning); }
.kpi.success .ico { background: var(--success-bg); color: var(--success); }
.kpi.danger .ico { background: var(--danger-bg); color: var(--danger); }
.kpi.purple .ico { background: var(--purple-bg); color: var(--purple); }
.kpi.cyan .ico { background: var(--cyan-bg); color: var(--cyan); }

/* ---------- 登录页 ---------- */
.auth-page { min-height: 100vh; display: flex; background: #0d1526; }
.auth-brand {
  flex: 1.15; position: relative; overflow: hidden; padding: 56px 64px; color: #fff;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(47,107,255,.32), transparent 60%),
    radial-gradient(700px 460px at 90% 85%, rgba(122,90,248,.25), transparent 60%),
    linear-gradient(150deg, #0b1220, #101c33 55%, #0d1526);
  display: flex; flex-direction: column;
}
.auth-brand .grid-lines {
  position: absolute; inset: 0; opacity: .16;
  background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 40% 40%, #000 30%, transparent 75%);
}
.auth-logo { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 700; letter-spacing: .3px; position: relative; }
.auth-logo .mark {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4d86ff, #2f6bff); box-shadow: 0 8px 20px rgba(47,107,255,.35);
}
.auth-hero { margin-top: auto; position: relative; max-width: 520px; }
.auth-hero h1 { font-size: 40px; line-height: 1.22; font-weight: 750; letter-spacing: -.5px; }
.auth-hero h1 span { background: linear-gradient(90deg, #79a5ff, #b4c7ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero p { margin-top: 18px; font-size: 14px; line-height: 1.9; color: rgba(255,255,255,.6); }
.auth-points { margin-top: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-point { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,.78); }
.auth-point i { width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.09); display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 12px; }
.auth-copy { margin-top: auto; padding-top: 40px; font-size: 12px; color: rgba(255,255,255,.32); position: relative; }

.auth-panel { width: 480px; background: #fff; display: flex; flex-direction: column; justify-content: center; padding: 48px 56px; }
.auth-panel h2 { font-size: 24px; font-weight: 750; letter-spacing: -.3px; }
.auth-panel .sub { margin-top: 8px; color: var(--ink-3); font-size: 13px; }
.auth-form { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-form .input { height: 44px; border-radius: 11px; }
.auth-form .btn { height: 44px; border-radius: 11px; font-size: 15px; margin-top: 4px; }
.auth-demo { margin-top: 22px; padding: 14px; border-radius: 12px; background: #f8fafc; border: 1px dashed var(--line-strong); }
.auth-demo .t { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 8px; }
.demo-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-btns button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 5px 9px; font-size: 11px; color: var(--ink-3); cursor: pointer; }
.demo-btns button:hover { border-color: var(--brand); color: var(--brand); }

@media (max-width: 1024px) {
  .auth-brand { display: none; }
  .auth-panel { width: 100%; padding: 32px 24px; }
}
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
}
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.dot-sep { color: var(--ink-4); margin: 0 6px; }
