/* =========================================================
 * 陪玩管理后台 - 全局样式（深色电竞风）
 * ========================================================= */
:root {
  --bg: #0d1024;
  --bg-soft: #131735;
  --card: #171c3d;
  --card-2: #1d2350;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef0ff;
  --text-dim: #8b90b5;
  --text-faint: #5d6385;
  --primary: #6c5ce7;
  --primary-2: #00d2ff;
  --grad: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  --success: #2ed573;
  --warning: #ffa502;
  --danger: #ff6b81;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  width: 100%;
  transition: border .2s, background .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: rgba(108, 92, 231, 0.08); }
textarea { resize: vertical; min-height: 90px; }
/* 下拉选择框：深色高对比 + 自定义箭头 */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  color: var(--text);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a79bf0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px;
  cursor: pointer;
}
select:hover { border-color: rgba(108, 92, 231, 0.6); }
select:disabled { opacity: .5; cursor: not-allowed; }
select option {
  background: #1d2350;
  color: #eef0ff;
  padding: 8px 10px;
}
select option:hover, select option:checked { background: var(--primary); color: #fff; }
::placeholder { color: var(--text-faint); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a3060; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 600; transition: all .2s; white-space: nowrap;
  background: rgba(255, 255, 255, 0.07); color: var(--text);
}
.btn:hover { background: rgba(255, 255, 255, 0.13); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(108, 92, 231, 0.35); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-success { background: rgba(46, 213, 115, 0.15); color: var(--success); }
.btn-success:hover { background: rgba(46, 213, 115, 0.28); }
.btn-danger { background: rgba(255, 107, 129, 0.12); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 107, 129, 0.25); }
.btn-warn { background: rgba(255, 165, 2, 0.12); color: var(--warning); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.icon-btn {
  background: transparent; border: none; color: var(--text-dim);
  font-size: 16px; padding: 6px; border-radius: 8px; transition: all .2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.link-btn { background: none; border: none; color: var(--text-dim); font-size: 13px; text-decoration: underline; margin-top: 20px; }
.link-btn:hover { color: var(--text); }

/* ---------- 徽章 / 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.tag-green { background: rgba(46, 213, 115, 0.15); color: var(--success); }
.tag-orange { background: rgba(255, 165, 2, 0.15); color: var(--warning); }
.tag-red { background: rgba(255, 107, 129, 0.15); color: var(--danger); }
.tag-purple { background: rgba(108, 92, 231, 0.2); color: #a79bf0; }
.tag-blue { background: rgba(0, 210, 255, 0.12); color: var(--primary-2); }
.tag-gray { background: rgba(255, 255, 255, 0.08); color: var(--text-dim); }

/* ---------- 头像 ---------- */
.avatar-lg { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; color: #fff; }
.avatar-md { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0; }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }

/* =========================================================
 * 登录页
 * ========================================================= */
.login-view {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow: hidden;
}
.login-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 20% 20%, #1b2150 0%, var(--bg) 60%); }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45; animation: float 8s ease-in-out infinite; }
.orb-1 { width: 420px; height: 420px; background: #6c5ce7; top: -120px; left: -100px; }
.orb-2 { width: 380px; height: 380px; background: #00d2ff; bottom: -140px; right: -80px; animation-delay: -3s; }
.orb-3 { width: 240px; height: 240px; background: #ff6b81; bottom: 10%; left: 15%; animation-delay: -5s; opacity: .25; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -30px) scale(1.08); }
}
.login-card {
  position: relative; z-index: 2; display: flex; width: 860px; max-width: 100%;
  border-radius: 24px; overflow: hidden; background: rgba(23, 28, 61, 0.85);
  backdrop-filter: blur(20px); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.login-brand {
  flex: 1.1; padding: 48px 40px; background: var(--grad);
  display: flex; flex-direction: column; justify-content: center;
}
.brand-icon { font-size: 52px; margin-bottom: 16px; filter: drop-shadow(0 6px 16px rgba(0,0,0,.3)); }
.brand-icon.small { font-size: 26px; margin-bottom: 0; }
.login-brand h1 { font-size: 30px; letter-spacing: 1px; }
.login-brand p { font-size: 12px; letter-spacing: 4px; opacity: .8; margin: 8px 0 24px; }
.brand-desc { font-size: 13px; opacity: .9; line-height: 1.7; }
.login-form { flex: 1; padding: 44px 40px; }
.login-form h2 { font-size: 24px; margin-bottom: 6px; }
.form-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 26px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }

/* =========================================================
 * 主布局
 * ========================================================= */
.app-view { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 236px; flex-shrink: 0; background: var(--bg-soft);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}
.sidebar-logo { display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid var(--border); }
.logo-name { font-size: 15px; font-weight: 700; }
.logo-mode { font-size: 11px; color: var(--primary-2); margin-top: 2px; }
.side-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 14px; border: none; background: transparent; color: var(--text-dim);
  border-radius: 10px; font-size: 14px; font-weight: 500; margin-bottom: 4px; text-align: left;
  transition: all .18s; position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(108, 92, 231, 0.35); }
.nav-item .nav-ico { font-size: 17px; width: 22px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 11px;
  min-width: 18px; height: 18px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.nav-section { font-size: 11px; color: var(--text-faint); padding: 14px 14px 6px; letter-spacing: 2px; }
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.side-user-info { flex: 1; min-width: 0; }
.side-user-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-role { font-size: 11px; color: var(--text-dim); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px; border-bottom: 1px solid var(--border); background: rgba(13, 16, 36, 0.7);
  backdrop-filter: blur(10px);
}
.topbar-left h2 { font-size: 20px; }
.page-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; display: block; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.date-chip { font-size: 13px; color: var(--text-dim); }
.mode-badge {
  background: var(--grad); color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 14px; border-radius: 20px;
}
.page-body { flex: 1; overflow-y: auto; padding: 24px 26px; }

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.card-title .sub { font-size: 12px; color: var(--text-dim); font-weight: 400; }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.stat-card .stat-ico { font-size: 26px; margin-bottom: 10px; }
.stat-card .stat-num { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat-card .stat-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.stat-card::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px;
  border-radius: 50%; background: var(--grad); opacity: 0.12; filter: blur(30px);
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 12px 14px; background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
tbody td { padding: 12px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(108, 92, 231, 0.06); }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user b { display: block; font-size: 14px; }
.cell-user small { color: var(--text-dim); font-size: 12px; }
.num-strong { font-weight: 800; color: var(--primary-2); }
.num-danger { font-weight: 800; color: var(--danger); }

/* 陪玩管理表：固定列宽布局，内容变化（如新增游戏）不会把其他列向后推 */
.pw-table { table-layout: fixed; }
.pw-table th, .pw-table td { overflow-wrap: break-word; word-break: break-word; }
.pw-table th:nth-child(1) { width: 8%; }
.pw-table th:nth-child(2) { width: 7%; }
.pw-table th:nth-child(3) { width: 20%; }
.pw-table th:nth-child(4) { width: 6%; }
.pw-table th:nth-child(5) { width: 7%; }
.pw-table th:nth-child(6) { width: 6%; }
.pw-table th:nth-child(7) { width: 9%; }
.pw-table th:nth-child(8) { width: 7%; }
.pw-table th:nth-child(9) { width: 15%; }
.pw-table th:nth-child(10) { width: 15%; }
.pw-table td:last-child { white-space: nowrap; }
.pw-table .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; padding: 50px 20px; color: var(--text-faint);
}
.empty .empty-ico { font-size: 42px; margin-bottom: 12px; }

/* ---------- 榜单 ---------- */
.rank-row { display: flex; align-items: center; gap: 12px; }
.rank-no {
  width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center;
  justify-content: center; font-weight: 800; background: rgba(255, 255, 255, 0.07);
  color: var(--text-dim); font-size: 13px; flex-shrink: 0;
}
.rank-no.top1 { background: linear-gradient(135deg, #ffd700, #ffa502); color: #3a2b00; }
.rank-no.top2 { background: linear-gradient(135deg, #c0c0c0, #8e8e9a); color: #222; }
.rank-no.top3 { background: linear-gradient(135deg, #cd7f32, #a0522d); color: #fff; }
.rank-me { outline: 2px solid var(--primary-2); outline-offset: -2px; }

/* ---------- 订单卡 ---------- */
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.order-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; transition: all .2s; display: flex; flex-direction: column; gap: 10px;
}
.order-card:hover { transform: translateY(-3px); border-color: rgba(108, 92, 231, 0.5); }
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-no { font-size: 12px; color: var(--text-faint); font-family: Consolas, monospace; }
.order-title { font-size: 15px; font-weight: 700; }
.order-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.order-meta span {
  font-size: 12px; background: rgba(255, 255, 255, 0.06); padding: 4px 9px;
  border-radius: 8px; color: var(--text-dim);
}
.order-note { font-size: 12.5px; color: var(--text-dim); background: rgba(255,255,255,0.04); padding: 8px 10px; border-radius: 8px; }
.order-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 4px; }
.order-price { font-size: 18px; font-weight: 800; color: var(--warning); }
.order-price small { font-size: 12px; color: var(--text-dim); font-weight: 400; }
.order-income { font-size: 12.5px; font-weight: 700; color: var(--success); }

/* ---------- 通知列表 ---------- */
.notice-item {
  display: flex; gap: 14px; padding: 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--card); margin-bottom: 12px; cursor: pointer;
  transition: all .2s; position: relative;
}
.notice-item:hover { border-color: rgba(108, 92, 231, 0.5); transform: translateY(-2px); }
.notice-item.unread { background: rgba(108, 92, 231, 0.08); border-color: rgba(108, 92, 231, 0.45); }
.notice-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-top: 7px; flex-shrink: 0; }
.notice-item.read .notice-dot { background: transparent; }
.notice-body { flex: 1; min-width: 0; }
.notice-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notice-content { font-size: 13px; color: var(--text-dim); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notice-foot { margin-top: 8px; font-size: 12px; color: var(--text-faint); display: flex; gap: 12px; align-items: center; }

/* ---------- 个人中心 ---------- */
.profile-top { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.profile-info h3 { font-size: 22px; margin-bottom: 4px; }
.profile-info .p-line { color: var(--text-dim); font-size: 13px; margin: 3px 0; }
.rate-stars { color: var(--warning); letter-spacing: 1px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(5, 7, 20, 0.72); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(4px); animation: fadeIn .18s ease;
}
.modal {
  width: 540px; max-width: 100%; max-height: 88vh; overflow-y: auto;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 18px;
  padding: 24px; box-shadow: var(--shadow); animation: popIn .22s ease;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h3 { font-size: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(.94) translateY(10px); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 12px;
  background: var(--card-2); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: 14px; animation: slideIn .25s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary-2); }
@keyframes slideIn { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---------- 工具条 ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search-box { display: flex; align-items: center; gap: 8px; }
.toolbar input { width: 240px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 18px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); font-size: 13.5px; font-weight: 600;
  transition: all .18s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--grad); color: #fff; border-color: transparent; }

/* ---------- 可搜索选择器（客户/陪玩选择） ---------- */
.pick-box { position: relative; }
.pick-drop {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--card-2); border: 1px solid rgba(108, 92, 231, 0.5);
  border-radius: 10px; max-height: 210px; overflow-y: auto;
  box-shadow: var(--shadow);
}
.pick-item { padding: 9px 12px; cursor: pointer; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border); }
.pick-item:last-child { border-bottom: none; }
.pick-item:hover { background: rgba(108, 92, 231, 0.25); }
.pick-item.sel { background: rgba(0, 210, 255, 0.15); color: var(--primary-2); font-weight: 600; }
.pick-empty { padding: 12px; color: var(--text-faint); font-size: 12px; text-align: center; }

/* ---------- 详情描述 ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.detail-item .d-label { font-size: 12px; color: var(--text-dim); margin-bottom: 3px; }
.detail-item .d-value { font-size: 14px; font-weight: 600; }

/* 响应式 */
@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .login-card { flex-direction: column; }
  .login-brand { padding: 30px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .sidebar { display: none; }
}
