/* 闪活 H5 — 移动端竖屏优先（品牌调性：天蓝底 + 橙金行动色） */
:root {
  --primary: #2E7CF6;
  --primary-dark: #1B5FD8;
  --accent: #FF7A1A;
  --accent-2: #FFB020;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --purple: #8B5CF6;
  --bg: #EEF4FC;
  --card: #FFFFFF;
  --text: #1F2937;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --border: #E5E7EB;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; }

/* ===== 通用 ===== */
.page { padding: 12px 16px 80px; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.card { background: var(--card); border-radius: 12px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 0 16px; height: 40px;
  font-size: 14px; font-weight: 500; cursor: pointer; transition: opacity .15s;
  background: linear-gradient(135deg, #FFA22E, #FF7A1A); color: #fff; width: 100%; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(255,122,26,.25);
}
.btn:active { opacity: .85; }
.btn:disabled { opacity: .5; }
.btn-ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); box-shadow: none; }
.btn-sm { height: 30px; font-size: 12px; border-radius: 8px; padding: 0 12px; width: auto; white-space: nowrap; flex-shrink: 0; box-shadow: none; }
.btn-danger { background: var(--danger); box-shadow: none; }
.btn-success { background: var(--success); box-shadow: none; }
.btn-warn { background: var(--warning); box-shadow: none; }
textarea.input { height: auto; min-height: 76px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input, select.input, textarea.input {
  width: 100%; height: 44px; border: 1px solid var(--border); border-radius: 10px;
  padding: 0 12px; font-size: 14px; background: #fff; color: var(--text); outline: none;
  transition: border .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field .req { color: var(--danger); }
.field .hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tag { display: inline-flex; align-items: center; font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 500;  white-space: nowrap; flex-shrink: 0;
}
.tag-blue { background: rgba(59,130,246,.12); color: var(--primary); }
.tag-green { background: rgba(16,185,129,.12); color: var(--success); }
.tag-orange { background: rgba(245,158,11,.15); color: var(--warning); }
.tag-red { background: rgba(239,68,68,.12); color: var(--danger); }
.tag-gray { background: rgba(107,114,128,.12); color: var(--text-2); }
.tag-purple { background: rgba(139,92,246,.12); color: var(--purple); }

.empty { text-align: center; padding: 48px 0; color: var(--text-3); font-size: 13px; }
.empty .ico { font-size: 40px; margin-bottom: 8px; }
.loading { text-align: center; padding: 40px; color: var(--text-3); }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 40; height: 52px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 10px;
}
.topbar .title { font-size: 16px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .count { font-size: 12px; color: var(--text-3); }

/* ===== Tab栏 ===== */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; border: none; background: #fff; color: var(--text-2);
  font-size: 13px; padding: 7px 14px; border-radius: 99px; cursor: pointer; font-weight: 500;
  border: 1px solid var(--border);
}
.tab.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 底部导航 ===== */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); display: flex; z-index: 50;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--text-3); font-size: 10px; padding-top: 6px;
}
.tabbar a .ti { font-size: 20px; line-height: 1; }
.tabbar a.on { color: var(--primary); font-weight: 600; }

/* ===== 登录页 ===== */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; background: linear-gradient(180deg, #BDE2FF 0%, #E8F3FF 42%, #F4F9FF 100%); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .big { font-size: 44px; }
.login-logo .login-icon { width: 76px; height: 76px; border-radius: 18px; box-shadow: 0 10px 26px rgba(46,124,246,.28); }
.login-logo h1 { font-size: 24px; margin-top: 12px; color: var(--primary-dark); letter-spacing: 2px; }
.login-logo p { font-size: 13px; color: var(--primary); opacity: .75; margin-top: 6px; }
.login-card { background: #fff; border-radius: 16px; padding: 24px 20px; box-shadow: 0 8px 30px rgba(46,124,246,.12); }
.topbar-logo { width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0; }

/* ===== 看板 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-cell { background: var(--card); border-radius: 12px; padding: 12px 8px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.stat-cell .num { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-cell .lbl { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.hero-stat { background: linear-gradient(135deg, var(--primary), #5AA9FF); border-radius: 16px; padding: 18px; color: #fff; margin-bottom: 12px; }
.hero-stat .lbl { font-size: 12px; opacity: .85; }
.hero-stat .val { font-size: 30px; font-weight: 700; margin-top: 2px; }
.hero-stat .sub { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.25); font-size: 12px; }
.hero-stat .sub b { display: block; font-size: 15px; margin-top: 1px; }

/* ===== 任务卡 ===== */
.task-card { display: flex; gap: 12px; }
.task-card .thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: #F3F4F6; flex-shrink: 0; }
.task-card .thumb-ph { width: 64px; height: 64px; border-radius: 10px; background: linear-gradient(135deg,#DBEAFE,#EDE9FE); display: flex; align-items: center; justify-content: center; font-size: 26px; flex-shrink: 0; }
.task-card .body { flex: 1; min-width: 0; }
.task-card h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.task-card h3 .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-card .meta { font-size: 12px; color: var(--text-3); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.task-card .price { color: var(--accent); font-weight: 700; font-size: 16px; }
.task-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

/* ===== 利润明细 ===== */
.profit-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.profit-line b { color: var(--text); }
.profit-line .pval { margin-left: auto; font-size: 14px; font-weight: 700; }
.p-pos { color: var(--success); } .p-neg { color: var(--danger); }

.op-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.op-row .btn-sm { flex: 1; min-width: 72px; }

/* ===== 列表条目 ===== */
.list-item { display: flex; gap: 10px; align-items: flex-start; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 14px; font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.list-item .li-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; word-break: break-all; }
.list-item .li-right { text-align: right; flex-shrink: 0; }

/* ===== 徽标按钮组 ===== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { font-size: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; cursor: pointer; background: #fff; color: var(--text-2); font-weight: 500; }
.chip.on-green { border-color: var(--success); background: rgba(16,185,129,.08); color: var(--success); }
.chip.on-blue { border-color: var(--primary); background: rgba(59,130,246,.08); color: var(--primary); }
.chip.on-red { border-color: var(--danger); background: rgba(239,68,68,.08); color: var(--danger); }
.chip.on-amber { border-color: var(--warning); background: rgba(245,158,11,.10); color: var(--warning); }

/* ===== 弹层 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .15s; }
.modal {
  background: #fff; width: 100%; max-width: 480px; border-radius: 16px 16px 0 0;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); max-height: 85vh; overflow-y: auto;
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 16px; margin-bottom: 12px; }
.modal { position: relative; }
.modal .close-x { position: absolute; top: 10px; right: 14px; z-index: 20; float: none; border: none; background: rgba(0,0,0,.06); font-size: 20px; color: var(--text-2); cursor: pointer; width: 40px; height: 40px; border-radius: 12px; line-height: 40px; padding: 0; }
.modal h3 { padding-right: 52px; }
.modal .modal-mask { -webkit-overflow-scrolling: touch; }

/* ===== toast ===== */
#toast-box { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: 86vw; }
.toast { background: rgba(17,24,39,.92); color: #fff; border-radius: 10px; padding: 10px 16px; font-size: 13px; animation: fadeIn .15s; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.ok { background: rgba(16,185,129,.94); }
.toast.err { background: rgba(239,68,68,.94); }

/* ===== 会话卡 ===== */
.sess-state { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 99px; display: inline-block; }
.dot-g { background: var(--success); box-shadow: 0 0 6px var(--success); }
.dot-r { background: var(--danger); }
.dot-y { background: var(--warning); }

.divider { height: 1px; background: var(--border); margin: 10px 0; }
.muted { color: var(--text-3); font-size: 12px; }
.link { color: var(--primary); text-decoration: none; font-size: 13px; cursor: pointer; }
.right { text-align: right; } .center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; }
.flex { display: flex; align-items: center; } .flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap8 { gap: 8px; } .wrap { flex-wrap: wrap; }

.tag-amber { background: #FEF3C7; color: #92400E; }

.upload-box { border: 2px dashed var(--primary); border-radius: 12px; padding: 22px 12px; text-align: center; color: var(--primary); font-size: 14px; font-weight: 500; cursor: pointer; background: rgba(59,130,246,.04); }
.upload-box:active { background: rgba(59,130,246,.1); }
.topbar .back { border: none; background: rgba(0,0,0,.04); width: auto; height: 34px; padding: 0 12px 0 8px; border-radius: 10px; font-size: 15px; color: var(--text-1); cursor: pointer; margin-right: 4px; }

/* v6: 同步日志单行截断 */
.log-line { display: flex; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.log-line:last-child { border-bottom: none; }
.log-line .log-msg { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.log-line .log-time { flex-shrink: 0; font-size: 11px; color: var(--text-3); }

/* 商品图片格子（发布页） */
.img-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.img-grid:empty { display: none; }
.img-cell { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--bg); }
.img-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-cell button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; line-height: 1; padding: 0; cursor: pointer; }
