/* ============================================================
   风格 A · 清新校园 — 设计系统
   主色 #10B981 绿 / 白卡片 / 圆角 / 微信小程序气质
   ============================================================ */
:root {
  --bg: #F3F7F5;
  --card: #FFFFFF;
  --line: #E7EDEA;
  --line-soft: #F0F4F2;
  --primary: #10B981;
  --primary-deep: #0B9B6B;
  --primary-soft: #E3F5EC;
  --primary-border: #C8ECD9;
  --text: #16211D;
  --text-2: #7A8A82;
  --text-3: #93A39B;
  --danger: #EF4444;
  --radius: 16px;
  --shadow: 0 2px 8px rgba(23, 43, 36, .05);
  --shadow-lg: 0 10px 26px rgba(16, 185, 129, .22);
}

* { 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", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--text); }
img { display: block; }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- 顶部栏 ---------- */
.appbar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 12px; background: var(--bg);
}
.appbar .brand { display: flex; align-items: center; gap: 10px; }
.appbar .brand .dot {
  width: 32px; height: 32px; border-radius: 11px; background: var(--primary);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.appbar .brand h1 { font-size: 18px; letter-spacing: .5px; }
.appbar .brand p { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.bal {
  display: flex; align-items: center; gap: 5px; background: var(--card);
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 99px;
  font-size: 13px; font-weight: 700; color: var(--primary-deep);
}
.bal .label { color: var(--text-2); font-weight: 500; }

/* 学生/骑手模式切换 */
.mode-switch {
  flex: none; display: flex; margin: 0 16px 10px; background: #E6EEE9;
  border-radius: 12px; padding: 3px; gap: 3px;
}
.mode-switch button {
  flex: 1; height: 34px; border: 0; border-radius: 10px; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.mode-switch button.on { background: #fff; color: var(--primary-deep); box-shadow: 0 1px 4px rgba(23,43,36,.08); }

/* ---------- 主内容 ---------- */
main { flex: 1; overflow-y: auto; padding: 0 16px 20px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: none; }
main::-webkit-scrollbar { display: none; }

.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.card-title { font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title small { font-weight: 500; color: var(--text-3); font-size: 11px; }

/* 通知卡 */
.notice {
  background: var(--primary-soft); border: 1px solid var(--primary-border);
  border-radius: var(--radius); padding: 13px 16px; display: flex; gap: 12px; align-items: center;
}
.notice .ic {
  width: 34px; height: 34px; flex: none; border-radius: 11px; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
}
.notice b { font-size: 14px; color: #14532D; display: block; }
.notice span { font-size: 12px; color: #3E7A58; display: block; margin-top: 2px; }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: #FBFDFC; outline: none; font-size: 15px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); background: #fff; }
.field textarea { resize: none; }

/* 按钮 */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 48px; border: 0; border-radius: 14px;
  font-size: 15px; font-weight: 700; letter-spacing: .5px; color: #fff;
  background: var(--primary); box-shadow: var(--shadow-lg);
}
.btn:active { transform: scale(.98); }
.btn.ghost { background: #fff; color: var(--primary-deep); border: 1.5px solid var(--primary); box-shadow: none; }
.btn.dark { background: var(--text); box-shadow: none; }
.btn.sm { height: 38px; font-size: 13px; border-radius: 11px; }
.btn.danger { background: var(--danger); box-shadow: none; }
.btn[disabled] { opacity: .5; }

/* 标签 */
.tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px; flex: none; }
.tag.go { color: #0E7490; background: #E0F2FE; }
.tag.wait { color: #B45309; background: #FEF3C7; }
.tag.done { color: #047857; background: #D1FAE5; }
.tag.miss { color: #6B7280; background: #F3F4F6; }
.tag.bad { color: #B91C1C; background: #FEE2E2; }

/* 订单列表项 */
.order-item { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.order-item:first-of-type { border-top: 0; padding-top: 0; }
.order-item .l1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.order-item b { font-size: 13px; }
.order-item p { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.order-item .price { font-weight: 700; color: var(--primary-deep); font-variant-numeric: tabular-nums; }

/* 价格明细 */
.target {
  display: flex; align-items: center; justify-content: space-between;
  background: #F6FAF8; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; font-size: 14px; font-weight: 600;
}
.target .chip { font-size: 11px; font-weight: 600; color: var(--primary-deep); background: var(--primary-soft); padding: 3px 9px; border-radius: 99px; }
.price-rows { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.price-rows .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.price-rows .row b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.price-rows .total { display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed #DFE8E3; margin-top: 4px; padding-top: 10px; }
.price-rows .total span { font-size: 13px; color: var(--text-2); }
.price-rows .total b { font-size: 22px; color: var(--primary); font-variant-numeric: tabular-nums; }
.split { font-size: 11px; color: var(--text-3); text-align: right; margin-top: 8px; }

/* 时间线 */
.timeline { margin-top: 4px; }
.tl-item { display: flex; gap: 12px; padding: 8px 0; }
.tl-dot { width: 10px; height: 10px; border-radius: 99px; background: #D6E0DB; margin-top: 5px; flex: none; }
.tl-item.on .tl-dot { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.tl-item b { font-size: 13px; color: var(--text-2); font-weight: 500; }
.tl-item.on b { color: var(--text); font-weight: 700; }
.tl-item span { font-size: 11px; color: var(--text-3); margin-left: 8px; }
.tl-item .tl-desc { display: block; font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* 底部导航 */
.tabbar {
  flex: none; background: #fff; border-top: 1px solid var(--line);
  display: flex; padding: 8px 0 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.tabbar .t {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; color: var(--text-3); text-decoration: none;
}
.tabbar .t.on { color: var(--primary); font-weight: 700; }

/* 空状态 / 加载 */
.empty { padding: 34px 0; text-align: center; font-size: 13px; color: var(--text-3); }
.loading { padding: 40px 0; text-align: center; font-size: 13px; color: var(--text-3); }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 0; }
.sec-head h2 { font-size: 15px; }
.sec-head a { font-size: 12px; color: var(--text-3); text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; gap: 26px; }
.login-brand { text-align: center; }
.login-brand .logo {
  width: 62px; height: 62px; border-radius: 20px; background: var(--primary);
  margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: var(--shadow-lg);
}
.login-brand h1 { font-size: 24px; letter-spacing: 1px; }
.login-brand p { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.seg { display: flex; background: #E6EEE9; border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 18px; }
.seg button { flex: 1; height: 36px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; font-weight: 600; color: var(--text-2); }
.seg button.on { background: #fff; color: var(--primary-deep); box-shadow: 0 1px 4px rgba(23,43,36,.08); }

/* ---------- 弹窗 / 提示 ---------- */
#toast { position: fixed; left: 50%; top: 60px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(22, 33, 29, .92); color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 99px; box-shadow: 0 6px 18px rgba(0,0,0,.18);
  animation: toast-in .25s ease; max-width: 82vw; text-align: center;
}
.toast.error { background: rgba(185, 28, 28, .94); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; } }

#modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(10, 20, 16, .55); }
#modal.show { display: flex; }
.modal-card { background: #fff; border-radius: 20px; width: 100%; max-width: 360px; padding: 20px; animation: toast-in .2s ease; }
.modal-card h3 { font-size: 16px; margin-bottom: 12px; }
.modal-card img { width: 100%; border-radius: 12px; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; }

/* 评价星星 */
.stars { display: flex; gap: 8px; justify-content: center; margin: 6px 0 14px; }
.stars button { font-size: 28px; line-height: 1; border: 0; background: none; color: #D6E0DB; }
.stars button.on { color: #F59E0B; }

/* 明细表 */
.kv { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13px; border-top: 1px solid var(--line-soft); }
.kv:first-of-type { border-top: 0; }
.kv span { color: var(--text-2); }
.kv b { font-variant-numeric: tabular-nums; }

/* 骑手工作台统计 */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { background: #F6FAF8; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat-box .num { font-size: 22px; font-weight: 800; color: var(--primary-deep); font-variant-numeric: tabular-nums; }
.stat-box .lbl { font-size: 11px; color: var(--text-3); margin-top: 3px; }

.photo-thumb { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.link { color: var(--primary-deep); font-size: 13px; font-weight: 600; background: none; border: 0; }

/* ---------- 管理端 ---------- */
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; flex: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs button {
  flex: none; height: 32px; padding: 0 15px; border-radius: 99px;
  border: 1px solid var(--line); background: #fff; font-size: 12px; font-weight: 600; color: var(--text-2);
}
.admin-tabs button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-row button {
  height: 28px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line);
  background: #fff; font-size: 11px; color: var(--text-2);
}
.filter-row button.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-deep); font-weight: 700; }
.rule-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.rule-row:first-of-type { border-top: 0; }
.rule-row span { flex: 1; font-size: 12px; color: var(--text-2); }
.rule-row input {
  width: 76px; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px; text-align: right; background: #FBFDFC; font-size: 14px;
}

/* ---------- SSE 实时追踪指示器 ---------- */
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 99px;
  background: var(--primary); box-shadow: 0 0 0 3px rgba(16, 185, 129, .15);
  animation: live-pulse 1.6s ease-in-out infinite; vertical-align: 1px; margin-right: 2px;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* ---------- PC 管理端(桌面布局,≥1024px 由 JS 切换) ---------- */
body.pc-mode #app { max-width: none; margin: 0; }
.pc-admin { display: flex; height: 100dvh; overflow: hidden; }
.pc-sidebar {
  width: 220px; flex: none; background: #16211D; color: #fff;
  display: flex; flex-direction: column; padding: 18px 0;
}
.pc-brand { display: flex; align-items: center; gap: 10px; padding: 0 18px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.pc-brand svg { width: 22px; height: 22px; color: #10B981; flex: none; }
.pc-brand b { font-size: 15px; display: block; letter-spacing: .5px; }
.pc-brand span { font-size: 10px; color: #7A8A82; }
.pc-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.pc-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 9px; font-size: 13px; color: #A8B6AF; cursor: pointer;
}
.pc-nav-item svg { width: 16px; height: 16px; flex: none; }
.pc-nav-item.on { background: #10B981; color: #fff; font-weight: 600; }
.pc-badge { margin-left: auto; background: #EF4444; color: #fff; font-size: 10px; padding: 1px 7px; border-radius: 99px; }
.pc-logout {
  margin: 10px; padding: 10px 12px; border-radius: 9px; font-size: 13px;
  color: #7A8A82; text-align: center; border: 1px solid rgba(255,255,255,.1); cursor: pointer;
}
.pc-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pc-topbar {
  height: 60px; flex: none; background: #fff; border-bottom: 1px solid #E2EAE6;
  display: flex; align-items: center; padding: 0 24px; gap: 16px;
}
.pc-topbar h2 { font-size: 16px; }
.pc-spacer { flex: 1; }
.pc-chip { font-size: 12px; color: #4A5A52; background: #F3F7F5; border: 1px solid #E2EAE6; padding: 6px 12px; border-radius: 99px; }
.pc-chip b { color: #10B981; }
.pc-user { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pc-avatar {
  width: 30px; height: 30px; border-radius: 99px; background: #E3F5EC; color: #0B9B6B;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.pc-content { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.pc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.pc-stat { background: #fff; border: 1px solid #E2EAE6; border-radius: 14px; padding: 16px 18px; }
.pc-stat .lbl { font-size: 12px; color: #7A8A82; }
.pc-stat .num { font-size: 26px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.pc-stat .num.green { color: #10B981; }
.pc-stat .sub { font-size: 11px; color: #93A39B; margin-top: 4px; }
.pc-panel { background: #fff; border: 1px solid #E2EAE6; border-radius: 14px; overflow: hidden; }
.pc-panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid #EFF4F2; }
.pc-panel-head h3 { font-size: 14px; }
.pc-count { font-size: 11px; color: #93A39B; }
.pc-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.pc-filters button {
  height: 26px; padding: 0 12px; border-radius: 99px; border: 1px solid #E2EAE6;
  background: #fff; font-size: 11px; color: #7A8A82; cursor: pointer;
}
.pc-filters button.on { background: #E3F5EC; border-color: #10B981; color: #0B9B6B; font-weight: 700; }
.pc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pc-table th {
  text-align: left; padding: 11px 18px; font-size: 11px; color: #93A39B;
  font-weight: 600; background: #FAFCFB; border-bottom: 1px solid #EFF4F2;
}
.pc-table td { padding: 11px 18px; border-bottom: 1px solid #F3F7F5; color: #4A5A52; }
.pc-table tr:last-child td { border-bottom: 0; }
.pc-table tr:hover td { background: #FAFCFB; }
.pc-table td b { color: #16211D; font-weight: 600; font-variant-numeric: tabular-nums; }
.pc-btn {
  height: 28px; padding: 0 14px; border: 0; border-radius: 8px;
  background: #10B981; color: #fff; font-size: 12px; font-weight: 600; cursor: pointer;
}
.pc-btn.ghost { background: #fff; color: #0B9B6B; border: 1px solid #10B981; }
.pc-btn.danger { background: #fff; color: #EF4444; border: 1px solid #FECACA; }
.pc-link { color: #10B981; font-size: 12px; font-weight: 600; background: none; border: 0; cursor: pointer; }
.pc-input {
  border: 1px solid #E2EAE6; border-radius: 8px; padding: 8px 12px;
  font-size: 13px; background: #FBFDFC; color: #16211D;
}
.pc-muted { color: #93A39B; font-size: 12px; }
.pc-empty { text-align: center; color: #93A39B; padding: 28px 0 !important; font-size: 13px; }
.pc-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
