/* 骑手装备置换 - 管理后台样式 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #e8f0ff;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar: #0f172a;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 8px 24px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

.app-shell { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .35);
}

.brand-text strong { display: block; color: #fff; font-size: 15px; letter-spacing: .3px; }
.brand-text span { display: block; font-size: 11px; color: #64748b; letter-spacing: 2px; margin-top: 1px; }

.side-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.side-nav::-webkit-scrollbar { width: 4px; }
.side-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.nav-group { margin-bottom: 18px; }
.nav-group-title {
  font-size: 11px;
  color: #475569;
  letter-spacing: 1px;
  padding: 0 10px;
  margin-bottom: 7px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 2px;
  transition: .18s;
  cursor: pointer;
}

.nav-item:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, .3); }
.nav-icon { width: 20px; text-align: center; font-size: 15px; }
.nav-count {
  margin-left: auto;
  background: rgba(255, 255, 255, .1);
  color: #94a3b8;
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 11px;
  min-width: 22px;
  text-align: center;
}
.nav-item.active .nav-count { background: rgba(255, 255, 255, .22); color: #fff; }
.nav-count.danger { background: var(--danger); color: #fff; }

.sidebar-foot { padding: 16px 20px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12px; color: #475569; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--success); margin-right: 6px; box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); }

/* ---------- 顶部栏 ---------- */
.main-shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.breadcrumb { color: var(--muted); font-size: 13px; white-space: nowrap; }
.breadcrumb .sep { margin: 0 9px; color: #cbd5e1; }
.breadcrumb strong { color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.top-search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 7px 12px;
  width: 240px;
  color: var(--muted);
  transition: .2s;
}
.top-search:focus-within { border-color: var(--primary); background: #fff; }
.top-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 13px; color: var(--text); }

.icon-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 9px;
  cursor: pointer;
  color: var(--muted);
  transition: .18s;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.menu-toggle { display: none; }

.admin-chip { display: flex; align-items: center; gap: 8px; padding-left: 10px; border-left: 1px solid var(--border); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.admin-name { font-size: 13px; font-weight: 600; }

/* ---------- 内容区 ---------- */
.view { padding: 26px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 15px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: .18s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 3px 10px rgba(37, 99, 235, .22); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-text { border: 0; background: transparent; color: var(--primary); padding: 4px 6px; }
.btn-text:hover { background: var(--primary-light); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: 15px; font-weight: 650; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-body { padding: 20px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px; border-radius: 50%; background: var(--primary-light); opacity: .55; }
.stat-label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 750; letter-spacing: -1px; position: relative; z-index: 1; }
.stat-trend { font-size: 11px; margin-top: 5px; color: var(--muted); position: relative; z-index: 1; }
.stat-trend.up { color: var(--success); }
.stat-icon { position: absolute; right: 18px; bottom: 16px; font-size: 26px; opacity: .85; z-index: 1; }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }

/* 柱状图 */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.chart-bar { width: 100%; max-width: 38px; background: linear-gradient(180deg, #60a5fa, var(--primary)); border-radius: 6px 6px 0 0; min-height: 4px; transition: .3s; position: relative; }
.chart-bar:hover { filter: brightness(1.08); }
.chart-bar span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.chart-label { font-size: 11px; color: var(--muted); }

/* 分布条 */
.dist-row { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; font-size: 12px; }
.dist-name { width: 76px; color: var(--muted); flex-shrink: 0; }
.dist-track { flex: 1; height: 8px; background: var(--bg); border-radius: 8px; overflow: hidden; }
.dist-fill { height: 100%; background: linear-gradient(90deg, #60a5fa, var(--primary)); border-radius: 8px; }
.dist-val { width: 28px; text-align: right; font-weight: 600; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 11px 16px; background: #f8fafc; white-space: nowrap; }
td { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tbody tr:hover { background: #f8fbff; }
.cell-user { display: flex; align-items: center; gap: 9px; }
.cell-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 17px; background: var(--primary-light); flex-shrink: 0; }
.cell-title { font-weight: 600; }
.cat-edit { cursor: pointer; }
.cat-edit:hover { color: var(--primary); }
.emoji-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.emoji-chip { width: 42px; height: 42px; border: 2px solid var(--border); border-radius: 10px; background: var(--card); font-size: 21px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .15s; }
.emoji-chip:hover { border-color: var(--primary); transform: translateY(-1px); }
.emoji-chip.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.cell-sub { color: var(--muted); font-size: 11px; margin-top: 1px; }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: #f1f5f9; color: #64748b; }
.badge-yellow { background: #fef3c7; color: #b45309; }

.toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar input, .toolbar select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 13px;
  outline: 0;
  background: #fff;
  color: var(--text);
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }
.toolbar .search-input { min-width: 210px; }
.toolbar-spacer { flex: 1; }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; color: var(--muted); font-size: 12px; }
.page-btns { display: flex; gap: 5px; }
.page-btn { border: 1px solid var(--border); background: #fff; border-radius: 7px; min-width: 30px; height: 30px; cursor: pointer; color: var(--muted); }
.page-btn.active, .page-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty-icon { font-size: 42px; display: block; margin-bottom: 12px; opacity: .6; }

/* 设置表单 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.form-item { display: flex; flex-direction: column; gap: 7px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { font-size: 12px; font-weight: 600; color: #475569; }
.form-item input, .form-item select, .form-item textarea {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  outline: 0;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  transition: .18s;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .08); }
.form-item textarea { min-height: 84px; resize: vertical; }
.form-hint { font-size: 11px; color: var(--muted); }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }
.switch-row strong { display: block; font-size: 13px; }
.switch-row p { font-size: 11px; color: var(--muted); margin-top: 2px; }
.switch { width: 42px; height: 24px; border-radius: 20px; background: #cbd5e1; position: relative; cursor: pointer; transition: .2s; flex-shrink: 0; }
.switch.on { background: var(--primary); }
.switch::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on::after { left: 21px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.2); animation: pop .2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16px; }
.modal-close { border: 0; background: transparent; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; }

/* Toast */
#toast-root { position: fixed; top: 78px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: slidein .25s ease-out; display: flex; align-items: center; gap: 8px; }
.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* 消息中心 */
.msg-layout { display: grid; grid-template-columns: 320px 1fr; gap: 0; min-height: 520px; }
@media (max-width: 860px) { .msg-layout { grid-template-columns: 1fr; } }
.msg-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 600px; }
.msg-item { padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 11px; align-items: center; transition: .15s; }
.msg-item:hover { background: #f8fbff; }
.msg-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); padding-left: 13px; }
.msg-item .cell-icon { width: 40px; height: 40px; font-size: 19px; }
.msg-preview { flex: 1; min-width: 0; }
.msg-preview strong { font-size: 13px; display: block; }
.msg-preview span { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.msg-time { font-size: 10px; color: #94a3b8; align-self: flex-start; }
.unread-dot { background: var(--danger); color: #fff; border-radius: 20px; font-size: 10px; padding: 1px 6px; }
.msg-conversation { padding: 18px; overflow-y: auto; max-height: 600px; background: #f8fafc; }
.bubble-row { display: flex; margin-bottom: 14px; }
.bubble-row.me { justify-content: flex-end; }
.bubble { max-width: 72%; padding: 9px 13px; border-radius: 12px; background: #fff; border: 1px solid var(--border); font-size: 13px; }
.bubble-row.me .bubble { background: var(--primary); color: #fff; border-color: var(--primary); }
.bubble-time { font-size: 10px; color: #94a3b8; margin-top: 4px; }
.bubble-row.me .bubble-time { text-align: right; }

/* 配置卡片 */
.config-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px; margin-bottom: 10px; background: #fff; }
.config-item input[type="text"] { width: 90px; border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; text-align: center; font-size: 13px; outline: 0; }
.config-item input[type="text"]:focus { border-color: var(--primary); }
.config-path { font-size: 11px; color: var(--muted); margin-left: auto; font-family: monospace; }

/* 数据卡片 */
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 15px; }
.action-card { padding: 20px; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
.action-card h4 { font-size: 14px; margin-bottom: 6px; }
.action-card p { font-size: 12px; color: var(--muted); margin-bottom: 14px; min-height: 36px; }

.log-list { max-height: 260px; overflow-y: auto; }
.log-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.log-item:last-child { border-bottom: 0; }
.log-time { color: #94a3b8; flex-shrink: 0; font-family: monospace; font-size: 11px; }

/* 响应式 */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -236px; transition: left .25s; box-shadow: 8px 0 30px rgba(0,0,0,.2); }
  .sidebar.open { left: 0; }
  .menu-toggle { display: flex; }
  .top-search { display: none; }
  .view { padding: 18px; }
  .admin-name { display: none; }
}
