:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e7e8ee;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --danger: #dc2626;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  margin: 0;
  background-color: #e5e7eb;
  background-image: linear-gradient(180deg, rgba(15, 23, 42, 0.12) 0%, rgba(15, 23, 42, 0.08) 55%, rgba(15, 23, 42, 0.12) 100%),
    url("/assets/bg.svg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
}

body.auth-page {
  background-color: #0b1220;
  background-image: linear-gradient(180deg, rgba(11, 18, 32, 0.74) 0%, rgba(11, 18, 32, 0.56) 55%, rgba(11, 18, 32, 0.78) 100%),
    url("/assets/bg.svg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.auth-page .auth-container {
  min-height: calc(100vh - 92px);
  display: flex;
  justify-content: center;
  align-items: center;
}

body.auth-page .auth-card {
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 30px 70px rgba(2, 6, 23, 0.38);
  backdrop-filter: blur(10px);
}

.container { max-width: 1240px; margin: 24px auto; padding: 0 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 240px; }
label { display: block; font-size: 12px; color: #475569; margin-bottom: 6px; }
input, select, textarea { width: 100%; box-sizing: border-box; padding: 10px 10px; border: 1px solid #cfd3e2; border-radius: 10px; background: #fff; color: var(--text); transition: box-shadow .14s ease, border-color .14s ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(37, 99, 235, .65); box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); }
textarea { min-height: 80px; }
button { padding: 10px 12px; border: 0; border-radius: 10px; background: var(--primary); color: #fff; cursor: pointer; transition: transform .08s ease, filter .14s ease, background-color .14s ease; }
button:hover { filter: brightness(1.02); }
button:active { transform: translateY(1px); }
button.secondary { background: #475569; }
button.danger { background: var(--danger); }
button:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.suggest-wrap { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid #cfd3e2; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.08); max-height: 260px; overflow: auto; z-index: 50; }
.suggest-item { padding: 10px 10px; cursor: pointer; font-size: 13px; }
.suggest-item:hover { background: #f1f5ff; }
.pm-item { display: flex; align-items: center; gap: 8px; }
.pm-icon { width: 16px; height: 16px; flex: 0 0 16px; display: inline-block; }
.pm-text { display: inline-block; }

.topbar { background: linear-gradient(135deg, #0b1220, #0f172a 55%, #111827); color: #fff; padding: 14px 0; box-shadow: 0 18px 40px rgba(15, 23, 42, .25); }
.topbar .container { display:flex; align-items:center; justify-content:space-between; margin: 0 auto; }
.topbar a { color: #c7d2fe; text-decoration: none; }
.nav { display:flex; gap: 10px; flex-wrap: wrap; }
.nav a { display:inline-flex; align-items:center; padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.12); background: rgba(17,24,39,.22); transition: background-color .14s ease, border-color .14s ease; }
.nav a:hover { background: rgba(99,102,241,.18); border-color: rgba(199,210,254,.35); }
.nav a.active { background: rgba(99,102,241,.25); border-color: rgba(199,210,254,.55); color: #ffffff; }
.nav-tagline { display:inline-flex; align-items:center; padding: 7px 6px; font-size: 12px; color: rgba(199,210,254,.9); }
.chip { display:inline-flex; align-items:center; gap:8px; background: rgba(17,24,39,.5); border:1px solid rgba(255,255,255,.15); padding:6px 10px; border-radius:999px; font-size:12px; }
.avatar-btn { display:inline-flex; align-items:center; justify-content:center; width: 36px; height: 36px; border-radius: 999px; padding: 0; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); cursor: pointer; }
.avatar-btn:hover { background: rgba(255,255,255,.16); }
.avatar-img { width: 34px; height: 34px; border-radius: 999px; object-fit: cover; display:block; }
.avatar-text { width: 34px; height: 34px; border-radius: 999px; display:flex; align-items:center; justify-content:center; font-size: 13px; font-weight: 800; color: #ffffff; background: linear-gradient(135deg, rgba(99,102,241,.75), rgba(37,99,235,.75)); }
.avatar-preview { width: 56px; height: 56px; border-radius: 999px; background: linear-gradient(135deg, #e0e7ff, #dbeafe); border: 1px solid #cfd3e2; overflow: hidden; display:flex; align-items:center; justify-content:center; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; display:block; }
.avatar-preview span { font-size: 18px; font-weight: 800; color: #1e293b; }

.avatar-uploader { position: relative; width: 56px; height: 56px; flex: 0 0 auto; }
.avatar-uploader .avatar-preview { width: 56px; height: 56px; }
.avatar-upload-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.avatar-upload-btn { position: absolute; right: 0; bottom: 0; transform: translate(28%, 28%); width: 24px; height: 24px; border-radius: 9px; background: #ffffff; border: 2px solid #2563eb; color: #2563eb; display:flex; align-items:center; justify-content:center; cursor: pointer; box-shadow: 0 12px 22px rgba(15, 23, 42, .18); }
.avatar-upload-btn:hover { background: #eff6ff; }
.avatar-upload-btn.disabled { opacity: 0.55; pointer-events: none; }
.avatar-upload-btn svg { width: 15px; height: 15px; }
.progress { width: 100%; height: 10px; border-radius: 999px; background: rgba(148, 163, 184, .25); overflow: hidden; border: 1px solid rgba(148, 163, 184, .35); }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, rgba(37,99,235,.95), rgba(99,102,241,.95)); }

.section-title { margin: 0 0 12px; font-size: 16px; letter-spacing: .2px; }
.subtle { color: var(--muted); font-size: 12px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.stack-10 { display:flex; gap:10px; align-items:center; }
.stack-12 { display:flex; gap:12px; align-items:center; }
.pager { display:flex; gap:10px; align-items:center; justify-content:flex-end; flex-wrap:wrap; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid #eef0f6; padding: 10px 8px; text-align:left; font-size: 13px; vertical-align: top; }
.table th { background: #fafbff; color: #334155; font-weight: 700; letter-spacing: .2px; }
.table tbody tr:hover { background: #fbfdff; }
.muted { color: var(--muted); font-size: 12px; }
.ok { color: #16a34a; }
.warn { color: #d97706; }
.err { color: #dc2626; }
.hidden { display: none !important; }
.right { text-align: right; }

.badge { display:inline-flex; align-items:center; padding:4px 10px; border-radius:999px; font-size:12px; font-weight:600; border:1px solid transparent; }
.badge { white-space: nowrap; justify-content: center; min-width: 74px; }
.badge.wait { color:#92400e; background:#fffbeb; border-color:#fde68a; }
.badge.ship { color:#1e40af; background:#eff6ff; border-color:#bfdbfe; }
.badge.done { color:#166534; background:#f0fdf4; border-color:#bbf7d0; }
.badge.unpaid { color:#9a3412; background:#fff7ed; border-color:#fed7aa; }
.badge.cancel { color:#991b1b; background:#fef2f2; border-color:#fecaca; }
.tag { display:inline-flex; align-items:center; padding:10px 12px; border-radius: 10px; border: 1px solid #cfd3e2; background: #f8fafc; color: #0f172a; font-size: 13px; font-weight: 600; min-height: 40px; box-sizing: border-box; }

.btn-sm { padding: 7px 10px; border-radius: 8px; font-size: 12px; }
button.ghost { background:#f1f5f9; color:#0f172a; }

.cell { min-width: 0; }
.ops { display:flex; flex-wrap:wrap; gap: 8px; align-items:center; }
.star-btn { padding: 6px 8px; border-radius: 10px; background: #f1f5f9; color: #0f172a; font-size: 14px; line-height: 1; }
.star-btn.active { background: rgba(245,158,11,.16); color: #b45309; }
.star-btn:hover { filter: brightness(1.02); }
.star-btn:active { transform: translateY(1px); }
.price-entry { display:flex; gap: 8px; align-items:center; }
.price-old { text-decoration: line-through; color: #94a3b8; font-size: 12px; white-space: nowrap; }
.price-input { width: 120px; text-align: right; }

.new-order-layout { display:grid; grid-template-columns: 1.1fr .9fr; gap: 18px; }
.new-order-block { border: 1px solid #eef0f6; border-radius: 14px; padding: 14px; background: #fff; }
.new-order-left .row > * { min-width: 210px; }
#oSmartText { min-height: 120px; }
#oRemark { min-height: 90px; }

@media (max-width: 980px) {
  .new-order-layout { grid-template-columns: 1fr; }
  .new-order-left .row > * { min-width: 100%; }
}

.animate-in { animation: viewIn .16s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.skel { position: relative; overflow: hidden; background: #e9edf5; border-radius: 10px; height: 12px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); animation: skelMove 1.05s infinite; }
.skel.lg { height: 14px; }
.skel.sm { height: 10px; border-radius: 8px; }
@keyframes skelMove { 100% { transform: translateX(100%); } }

.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 18px; opacity: 0; pointer-events: none; transition: opacity .16s ease; }
.modal.open { opacity: 1; pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); opacity: 0; transition: opacity .16s ease; }
.modal.open .modal-backdrop { opacity: 1; }
.modal-dialog { position: relative; width: 100%; max-width: 980px; max-height: calc(100vh - 36px); overflow: auto; transform: translateY(10px) scale(.985); transition: transform .16s ease; box-shadow: var(--shadow); }
.modal.open .modal-dialog { transform: translateY(0) scale(1); }
.modal-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; border-bottom: 1px solid #eef0f6; padding-bottom: 12px; margin-bottom: 12px; }
.kv { display:grid; grid-template-columns: 140px 1fr; gap: 8px 12px; }
.kv .k { color:#64748b; font-size: 12px; }
.kv .v { font-size: 13px; }

.ui-loading-dialog { text-align: center; }
.ui-loading-body { display:flex; flex-direction:column; align-items:center; justify-content:center; padding: 10px 6px; gap: 14px; }
.ui-loading-text { font-size: 14px; font-weight: 800; letter-spacing: .2px; color: #0f172a; }
.ui-loading-spin { width: 44px; height: 44px; border-radius: 999px; border: 4px solid rgba(99,102,241,.18); border-top-color: rgba(37,99,235,.95); animation: uiSpin .9s linear infinite; }
@keyframes uiSpin { to { transform: rotate(360deg); } }

.toast-wrap { position: fixed; top: 14px; right: 14px; z-index: 9999; display:flex; flex-direction:column; gap: 10px; width: min(360px, calc(100vw - 28px)); pointer-events:none; }
.toast { pointer-events:auto; padding: 12px 12px; border-radius: 14px; border: 1px solid rgba(231,232,238,.9); background: rgba(255,255,255,.92); box-shadow: 0 18px 40px rgba(15,23,42,.12); color: #0f172a; font-size: 13px; line-height: 1.35; transform: translateY(-6px); opacity: 0; transition: transform .18s ease, opacity .18s ease; backdrop-filter: blur(10px); }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.hide { opacity: 0; transform: translateY(-6px); }
.toast.ok { border-color: rgba(34,197,94,.35); }
.toast.err { border-color: rgba(220,38,38,.35); }
.toast.warn { border-color: rgba(245,158,11,.35); }

.ui-confirm-body { font-size: 13px; color: #0f172a; line-height: 1.5; }
.ui-confirm-actions { display:flex; gap: 10px; justify-content:flex-end; margin-top: 14px; }
.ui-confirm-actions button { min-width: 96px; }
.ui-confirm-actions button.hidden { display:none; }

.success-dialog { text-align: center; }
.success-body { display:flex; flex-direction:column; align-items:center; padding: 8px 6px 2px; }
.success-title { font-size: 18px; font-weight: 800; letter-spacing: .2px; margin-top: 10px; }
.success-sub { margin-top: 6px; }
.success-check { width: 72px; height: 72px; display:flex; align-items:center; justify-content:center; }
.checkmark { width: 72px; height: 72px; }
.checkmark-circle { stroke: #16a34a; stroke-width: 3.5; stroke-miterlimit: 10; stroke-dasharray: 166; stroke-dashoffset: 166; animation: checkCircle .55s ease-out forwards; }
.checkmark-check { stroke: #16a34a; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: checkStroke .38s .18s ease-out forwards; }
.modal.open .success-dialog { animation: popIn .22s ease-out both; }
@keyframes checkCircle { to { stroke-dashoffset: 0; } }
@keyframes checkStroke { to { stroke-dashoffset: 0; } }
@keyframes popIn { from { transform: translateY(10px) scale(.98); } to { transform: translateY(0) scale(1); } }

.auth-card { max-width: 520px; margin: 28px auto; }

label.req::before { content: "*"; color: var(--danger); margin-right: 4px; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 38px;
}

.phone-fields { display:flex; gap: 12px; align-items:center; }
.phone-fields .phone-code { flex: 1 1 0; min-width: 0; }
.phone-fields > input { flex: 4 1 0; min-width: 0; }

.captcha-wrap { display:flex; gap: 10px; align-items:center; }
.captcha-wrap input { flex: 1; min-width: 0; }
.captcha-img { width: 120px; height: 40px; flex: 0 0 120px; display:flex; align-items:center; justify-content:center; border: 1px solid #cfd3e2; border-radius: 10px; background: #fff; overflow: hidden; cursor: pointer; }
.captcha-img svg { display:block; width: 120px; height: 40px; }

@media (prefers-reduced-motion: reduce) {
  button, input, select, textarea { transition: none; }
  .animate-in { animation: none; }
  .skel::after { animation: none; }
  .modal, .modal-backdrop, .modal-dialog { transition: none; }
}

@media (max-width: 860px) {
  .container { padding: 0 12px; margin: 14px auto; }
  .card { padding: 14px; }
  .topbar .container { flex-direction: column; align-items: flex-start; gap: 10px; }
  .nav { gap: 8px; }
  .row > * { min-width: 100%; }

  body.auth-page {
    background-attachment: scroll;
  }

  #ordersTable thead { display:none; }
  #ordersTable, #ordersTable tbody, #ordersTable tr, #ordersTable td { display:block; width:100%; }
  #ordersTable tbody tr { border: 1px solid #eef0f6; border-radius: 14px; padding: 12px; margin-bottom: 12px; background: #fff; }
  #ordersTable tbody tr:hover { background: #fff; }
  #ordersTable td { border: 0; padding: 10px 0; }
  #ordersTable td { display:flex; gap: 10px; align-items:flex-start; }
  #ordersTable td::before { content: attr(data-label); flex: 0 0 92px; font-size: 12px; color: #64748b; font-weight: 700; }
  #ordersTable td .cell { flex: 1; }
  #ordersTable td[data-label="操作"] { padding-top: 12px; }
  #ordersTable td[data-label="操作"]::before { display:none; }
  #ordersTable td[data-label="操作"] .ops { justify-content:flex-start; }
}
