* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #2563eb; --primary-dark: #1d4ed8;
  --ok: #10b981; --warn: #f59e0b; --danger: #ef4444;
  --ink: #0f172a; --ink2: #334155; --ink3: #64748b; --line: #e2e8f0;
  --bg: #f4f6fb;
}
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; }

/* ================= 登录页 ================= */
.login-wrap { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #0b1220; overflow: hidden; }
.login-bg { position: absolute; inset: 0;
  background:
    radial-gradient(700px 420px at 18% -10%, rgba(37,99,235,.35), transparent 60%),
    radial-gradient(640px 420px at 100% 110%, rgba(14,165,233,.22), transparent 60%),
    #0b1220; }
.login-card { position: relative; z-index: 1; width: 360px; max-width: calc(100vw - 40px);
  background: rgba(255,255,255,.97); border-radius: 20px; padding: 38px 32px 30px;
  box-shadow: 0 24px 70px rgba(0,0,0,.45); text-align: center; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 14px; }
.login-card h1 { font-size: 22px; letter-spacing: 1px; }
.login-sub { font-size: 13px; color: var(--ink3); margin: 8px 0 24px; }
.login-field { display: flex; align-items: center; gap: 9px; border: 1.5px solid var(--line);
  border-radius: 11px; padding: 0 13px; margin-bottom: 14px; background: #f8fafc; transition: .15s; }
.login-field:focus-within { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.login-field input { flex: 1; border: none; background: transparent; padding: 13px 0; font-size: 15px; outline: none; }
.btn-primary { width: 100%; padding: 13px; background: linear-gradient(135deg,#2563eb,#1d4ed8); color: #fff;
  border: none; border-radius: 11px; font-size: 16px; font-weight: 700; letter-spacing: 4px; cursor: pointer;
  box-shadow: 0 8px 20px rgba(37,99,235,.3); transition: .15s; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: #93c5fd; box-shadow: none; }
.err { color: var(--danger); font-size: 13px; margin-top: 11px; min-height: 16px; }
.login-foot { position: relative; z-index: 1; margin-top: 22px; font-size: 12px; color: #64748b; }

/* ================= 顶栏 ================= */
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 9px; padding: 10px 0; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: .5px; }
.conn-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink3);
  background: #f1f5f9; padding: 3px 9px; border-radius: 20px; margin-left: 6px; }
.conn-state .dot { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; }
.conn-state.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.conn-state.bad { color: var(--danger); }
.conn-state.bad .dot { background: var(--danger); }
.top-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 0; }
.btn-ghost { padding: 7px 11px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  font-size: 13px; cursor: pointer; color: var(--ink2); display: inline-flex; align-items: center; gap: 4px; transition: .15s; }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost.wide { width: 100%; justify-content: center; margin-bottom: 10px; }
.btn-ghost.spin svg { animation: spin 1s linear infinite; }
.voice-switch { font-size: 13px; color: var(--ink2); display: flex; align-items: center; gap: 4px; margin: 0 4px; }

/* ================= 统计卡片 ================= */
.stat-row { max-width: 920px; margin: 14px auto 0; padding: 0 12px; display: grid;
  grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-card { background: #fff; border-radius: 14px; padding: 14px 16px; border: 1px solid var(--line);
  position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -12px; top: -12px; width: 52px; height: 52px; border-radius: 50%; opacity: .12; }
.st-pending::after { background: var(--warn); } .st-new::after { background: var(--primary); }
.st-done::after { background: var(--ok); } .st-sync::after { background: #0ea5e9; }
.st-num { font-size: 26px; font-weight: 800; line-height: 1.1; }
.st-label { font-size: 12.5px; color: var(--ink3); margin-top: 2px; }
.st-pending .st-num { color: var(--warn); } .st-new .st-num { color: var(--primary); }
.st-done .st-num { color: var(--ok); } .st-sync .st-num { color: #0284c7; }

/* ================= 标签页 ================= */
.tabs { max-width: 920px; margin: 12px auto 0; padding: 0 12px; display: flex; gap: 4px;
  border-bottom: 1px solid var(--line); }
.tab { padding: 11px 14px; border: none; background: none; font-size: 14px; color: var(--ink3);
  cursor: pointer; border-bottom: 2.5px solid transparent; font-weight: 600; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.badge { display: inline-block; min-width: 19px; padding: 1px 6px; background: var(--danger); color: #fff;
  border-radius: 11px; font-size: 12px; margin-left: 2px; font-weight: 700; }

/* ================= 订单卡片 ================= */
.order-list { max-width: 920px; margin: 0 auto; padding: 12px; }
.order-card { background: #fff; border-radius: 14px; padding: 15px 17px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(15,23,42,.07); border: 1px solid var(--line); border-left: 5px solid var(--warn); }
.order-card.shipped { border-left-color: var(--ok); opacity: .8; }
.order-card.refunded { border-left-color: #94a3b8; opacity: .72; }
.order-card.error { border-left-color: var(--danger); }
.order-card.fetching { border-left-color: #0ea5e9; opacity: .85; }
.order-card.flash { animation: cardFlash 1.1s ease-out 3; }
@keyframes cardFlash { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,.55);} 100% { box-shadow: 0 0 0 16px rgba(239,68,68,0);} }
.oc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
.oc-tid { font-size: 12.5px; color: var(--ink3); font-family: ui-monospace, Menlo, monospace; cursor: pointer; }
.oc-tid:hover { color: var(--primary); }
.oc-status { font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 700; white-space: nowrap; }
.st-pending { background: #fef3c7; color: #b45309; }
.st-shipped { background: #d1fae5; color: #047857; }
.st-refunded { background: #e2e8f0; color: #475569; }
.st-error { background: #fee2e2; color: #b91c1c; }
.st-ignored { background: #e2e8f0; color: #64748b; }
.st-fetching { background: #e0f2fe; color: #0369a1; }
.oc-title { font-size: 15.5px; font-weight: 700; margin-bottom: 4px; }
.oc-sku { font-size: 14px; color: var(--primary); font-weight: 700; margin-bottom: 4px; }
.oc-account { background: #fffbeb; border: 1.5px dashed #f59e0b; border-radius: 10px; padding: 10px 13px;
  margin: 9px 0; font-size: 17px; font-weight: 800; color: #b45309; word-break: break-all; cursor: pointer; position: relative; }
.oc-account:active { background: #fef3c7; }
.oc-account .lbl { font-size: 12px; color: #92400e; font-weight: 500; display: block; margin-bottom: 2px; }
.oc-account.no-msg { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; font-size: 15px; }
.oc-meta { font-size: 13px; color: var(--ink3); display: flex; flex-wrap: wrap; gap: 14px; }
.oc-meta b { color: var(--danger); }
.oc-actions { display: flex; gap: 10px; margin-top: 13px; }
.btn-ship { flex: 1; padding: 14px; background: var(--ok); color: #fff; border: none; border-radius: 10px;
  font-size: 16px; font-weight: 800; cursor: pointer; box-shadow: 0 6px 16px rgba(16,185,129,.3); transition: .15s; }
.btn-ship:active { transform: translateY(1px); background: #059669; }
.btn-ship:disabled { background: #a7f3d0; box-shadow: none; }
.btn-ignore { padding: 14px 20px; background: #fff; border: 1px solid #d1d5db; border-radius: 10px;
  font-size: 14px; cursor: pointer; color: var(--ink3); }
.oc-result { margin-top: 9px; font-size: 12.5px; color: #b91c1c; background: #fef2f2; border-radius: 8px;
  padding: 7px 10px; word-break: break-all; }
.oc-fetch-note { font-size: 13px; color: #0369a1; padding: 10px 0; }
.empty-tip { text-align: center; color: #94a3b8; padding: 70px 20px; font-size: 14px; }
.empty-tip p { margin-top: 12px; }

/* ================= 弹窗 ================= */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px); }
.modal-box { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.3); animation: pop .18s ease; }
.modal-box.large { max-width: 660px; }
@keyframes pop { from { transform: scale(.96); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center;
  padding: 17px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; }
.x { border: none; background: none; font-size: 28px; color: #94a3b8; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; overflow-y: auto; }
.sec-title { font-size: 14px; color: var(--ink); margin: 18px 0 10px; padding-left: 9px; border-left: 3px solid var(--primary); }
.sec-title:first-child { margin-top: 0; }

/* ================= 表单 ================= */
.field { display: block; margin-bottom: 14px; font-size: 13px; color: var(--ink2); }
.field.check { display: flex; align-items: flex-start; gap: 7px; font-size: 14px; color: var(--ink); margin-bottom: 10px; }
.field input:not([type=checkbox]) { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line);
  border-radius: 9px; font-size: 14px; margin-top: 5px; outline: none; transition: .15s; }
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.webhook-tip { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 11px 13px;
  font-size: 12.5px; color: #1e40af; margin: 14px 0; word-break: break-all; }

/* ================= 规则 ================= */
.rule-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.rule-form input, .rule-form select { padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 9px;
  font-size: 14px; outline: none; }
.rule-form .btn-primary { grid-column: 1 / -1; }
.rule-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 11px; margin-bottom: 9px; gap: 8px; }
.rule-item .ri-main { font-size: 14px; font-weight: 600; }
.rule-item .ri-sub { font-size: 12px; color: var(--ink3); margin-top: 3px; font-weight: 400; }
.rule-item.off { opacity: .5; }
.rule-item .ri-ops { white-space: nowrap; }
.rule-item .ri-ops button { margin-left: 6px; padding: 6px 11px; font-size: 12px; border: 1px solid var(--line);
  background: #fff; border-radius: 7px; cursor: pointer; }
.rule-item .ri-ops .del { color: var(--danger); border-color: #fecaca; }

/* ================= 语音设置 ================= */
.voice-block { background: #f8fafc; border: 1px solid var(--line); border-radius: 13px; padding: 14px 16px; margin-bottom: 14px; }
.vc-row { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.vc-label { font-size: 13.5px; color: var(--ink2); width: 78px; flex-shrink: 0; }
.vc-slider { flex: 1; accent-color: var(--primary); }
.vc-val { font-size: 13px; color: var(--ink3); width: 42px; text-align: right; }
.vc-row select { flex: 1; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 9px; font-size: 14px;
  background: #fff; outline: none; }
.vc-events { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.vc-events .vc-label { width: auto; }
.vc-events .chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; }

/* ================= 改密 ================= */
.pwd-warn { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; border-radius: 10px;
  padding: 10px 13px; font-size: 13px; margin-bottom: 14px; }
.pwd-tip { font-size: 12px; color: var(--ink3); margin: 4px 0 12px; }

/* ================= 备份 ================= */
.backup-bar { display: flex; gap: 9px; margin-bottom: 10px; }
.backup-list { font-size: 13px; }
.backup-item { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9; gap: 10px; }
.backup-item .bi-info { color: var(--ink3); font-size: 12px; }
.backup-item a { color: var(--primary); text-decoration: none; font-size: 13px; font-weight: 600; }
.backup-empty { color: #94a3b8; font-size: 13px; padding: 8px 0; }

/* ================= 日志 ================= */
.log-list { font-size: 13px; }
.log-item { padding: 9px 0; border-bottom: 1px solid #f5f7fa; display: flex; gap: 10px; }
.log-item .lt { color: #94a3b8; font-size: 12px; white-space: nowrap; padding-top: 1px; }
.log-item.error .lc { color: var(--danger); }
.log-item.notify .lc { color: var(--primary); }
.log-item.ship .lc { color: #047857; }
.log-item.sync .lc { color: #0369a1; }

/* ================= 轻提示 ================= */
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: rgba(15,23,42,.92);
  color: #fff; padding: 11px 22px; border-radius: 24px; font-size: 14px; z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: toastIn .2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= 移动端 ================= */
@media (max-width: 640px) {
  .topbar { padding: 0 10px; }
  .brand-name { font-size: 15px; }
  .conn-state { display: none; }
  .top-actions { width: 100%; justify-content: flex-start; overflow-x: auto; }
  .btn-ghost { padding: 6px 9px; font-size: 12px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .tabs { overflow-x: auto; }
  .tab { padding: 10px 12px; font-size: 13px; white-space: nowrap; }
  .rule-form { grid-template-columns: 1fr; }
  .oc-account { font-size: 16px; }
}
