* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f5f7fb; color: #1f2d3d; }
a { color: #2563eb; text-decoration: none; }
button { cursor: pointer; }

.btn { padding: 8px 16px; border: none; border-radius: 6px; background: #2563eb; color: #fff; font-size: 14px; }
.btn:hover { background: #1d4ed8; }
.btn.gray { background: #e5e7eb; color: #374151; }
.btn.gray:hover { background: #d1d5db; }
.btn.danger { background: #dc2626; }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 20px; }

input, select, textarea { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; outline: none; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: #2563eb; }
label { font-size: 13px; color: #6b7280; display: block; margin-bottom: 4px; }
.form-row { margin-bottom: 14px; }
.switch { position: relative; display: inline-block; width: 42px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #d1d5db; border-radius: 22px; transition: .2s; }
.switch .slider:before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: #2563eb; }
.switch input:checked + .slider:before { transform: translateX(20px); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid #eef0f3; text-align: left; white-space: nowrap; }
.table th { background: #f9fafb; color: #6b7280; font-weight: 600; }
.table tr:hover { background: #f8fafc; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge.active { background: #dcfce7; color: #15803d; }
.badge.disabled { background: #fee2e2; color: #b91c1c; }
.badge.frozen { background: #fef3c7; color: #b45309; }
.badge.live { background: #dcfce7; color: #15803d; }
.badge.ended { background: #e5e7eb; color: #4b5563; }
.badge.banned { background: #fee2e2; color: #b91c1c; }

.topbar { display: flex; align-items: center; justify-content: space-between; background: #fff; padding: 12px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.topbar .title { font-size: 18px; font-weight: 700; }
.topbar .user { font-size: 13px; color: #6b7280; }

.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 210px; background: #fff; border-right: 1px solid #eef0f3; padding: 12px 0; flex-shrink: 0; }
.sidebar a { display: block; padding: 10px 20px; color: #4b5563; font-size: 14px; }
.sidebar a.active, .sidebar a:hover { background: #eff6ff; color: #2563eb; border-left: 3px solid #2563eb; }
.main { flex: 1; padding: 20px; overflow: auto; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; }
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat .num { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat .lbl { font-size: 13px; color: #6b7280; }

.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 10px 18px; border-radius: 8px; background: #111827; color: #fff; font-size: 14px; z-index: 999; opacity: 1; transition: opacity .3s; }
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.hide { opacity: 0; }

.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.hide { display: none !important; }
.modal { background: #fff; border-radius: 12px; padding: 22px; width: 420px; max-width: 92vw; max-height: 88vh; overflow: auto; }
.modal h3 { margin-bottom: 16px; }
.modal .btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* Refreshed workspace theme */
:root { --brand:#3563e9; --ink:#182844; --muted:#75829a; --line:#e7ecf5; }
body { color:var(--ink); background:#f3f6fc; line-height:1.6; }
button,input,select,textarea { font:inherit; }
button,a,input,select,textarea { -webkit-tap-highlight-color:transparent; }
button:focus-visible,a:focus-visible { outline:3px solid #95b4ff; outline-offset:3px; }
.btn { border-radius:10px; padding:10px 18px; font-weight:600; background:var(--brand); transition:background .18s,box-shadow .18s; }
.btn:hover { background:#254dca; box-shadow:0 4px 12px #3563e925; }
.btn.gray { background:#eef2f9; color:#53627e; }
.btn.sm { padding:6px 12px; }
.card,.stat { border:1px solid var(--line); border-radius:18px; box-shadow:0 5px 24px #23386305; padding:24px; }
.card { overflow-x:auto; }
h3 { font-size:16px; font-weight:650; letter-spacing:.2px; }
input,select,textarea { border-color:#dfe5ef; border-radius:10px; padding:10px 12px; background:#fcfdff; color:var(--ink); }
input:focus,select:focus,textarea:focus { border-color:var(--brand); box-shadow:0 0 0 3px #3563e912; }
label { color:#53627e; margin-bottom:7px; }
.topbar { min-height:76px; padding:16px 32px; border-bottom:1px solid var(--line); box-shadow:none; gap:12px; }
.topbar .title { font-size:19px; letter-spacing:.4px; }
.topbar .user { display:flex; align-items:center; gap:14px; }
.layout { min-height:calc(100vh - 76px); }
.sidebar { width:224px; padding:24px 14px; background:#fff; border-color:var(--line); }
.sidebar:before { content:'WORKSPACE / 工作空间'; display:block; font-size:10px; font-weight:700; letter-spacing:1.4px; color:#9aa6ba; padding:0 14px 20px; }
.sidebar a { cursor:pointer; margin:4px 0; border-radius:10px; padding:11px 15px; border-left:3px solid transparent; color:#62708a; }
.sidebar a.active,.sidebar a:hover { background:#edf2ff; border-left:3px solid var(--brand); color:var(--brand); }
.main { min-width:0; padding:30px; }
.page-heading { margin-bottom:25px; }
.page-heading h1 { font-size:26px; letter-spacing:-.6px; margin-bottom:5px; }
.page-heading p { font-size:14px; color:var(--muted); }
.toolbar { gap:12px; margin-bottom:20px; }
.table { margin-top:14px; }
.table th { background:#f6f8fc; color:#8390a6; font-size:12px; }
.table td,.table th { padding:13px 14px; border-color:#edf0f6; }
.table tbody tr:last-child td { border-bottom:0; }
.stat { position:relative; padding:22px; border-top:3px solid #bdceff; }
.stat:nth-child(2) { border-top-color:#9bded0; }
.stat:nth-child(3) { border-top-color:#c6bafa; }
.stat:nth-child(4) { border-top-color:#f1d098; }
.stat .num { font-size:32px; font-variant-numeric:tabular-nums; letter-spacing:-1px; }
.stat .lbl { color:var(--muted); }
.badge { padding:3px 10px; font-weight:500; }
.pagination { color:var(--muted); margin-top:20px; flex-wrap:wrap; }
.modal-mask { background:#15274470; backdrop-filter:blur(5px); padding:16px; }
.modal { border-radius:20px; padding:28px; box-shadow:0 24px 80px #15274430; }
.toast { box-shadow:0 8px 30px #18284425; max-width:90vw; text-align:center; }
@media(max-width:1000px) { .grid4 { grid-template-columns:repeat(2,minmax(0,1fr)); } .main { padding:22px; } }
@media(max-width:700px) {
 .topbar { padding:15px 18px; flex-wrap:wrap; } .topbar .title { font-size:17px; }
 .layout { flex-direction:column; } .sidebar { width:100%; display:flex; overflow-x:auto; padding:10px 12px; gap:6px; border-bottom:1px solid var(--line); }
 .sidebar:before { display:none; } .sidebar a { white-space:nowrap; flex-shrink:0; margin:0; padding:8px 12px; }
 .main { padding:20px 14px; } .card,.stat { padding:18px; border-radius:14px; }
 .grid2 { grid-template-columns:minmax(0,1fr); } .grid4 { gap:10px; } .stat .num { font-size:27px; }
 .page-heading h1 { font-size:23px; } .toolbar input,.toolbar select { max-width:100%; }
 /* 小屏：表格转卡片，避免横向溢出 */
 .table { display:none; }
 .m-cards { display:block !important; }
 .modal { padding:22px 18px; }
 .modal .btns { flex-wrap:wrap; } .modal .btns .btn { flex:1; min-width:120px; }
}

/* ========== 移动端卡片列表（与 .table 二选一渲染） ========== */
.m-cards { display:none; }
.m-card { background:#fff; border:1px solid var(--line); border-radius:14px; padding:14px 16px; margin-bottom:12px; box-shadow:0 1px 4px #1828440a; }
.m-card .m-title { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; }
.m-card .m-title b { font-size:15px; }
.m-card .m-row { display:flex; justify-content:space-between; gap:12px; font-size:13px; padding:5px 0; color:var(--muted); }
.m-card .m-row b { color:var(--ink); font-weight:600; text-align:right; word-break:break-all; }
.m-card .m-ops { display:flex; gap:8px; margin-top:10px; }
.m-card .m-ops .btn { flex:1; }

/* ========== 个人中心 ========== */
.profile-head { display:flex; align-items:center; gap:18px; padding:6px 4px 20px; }
.avatar { width:64px; height:64px; border-radius:20px; background:linear-gradient(135deg,#3563e9,#6d8dff); color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:26px; font-weight:700; flex-shrink:0; box-shadow:0 8px 20px #3563e933; }
.avatar.sm { width:38px; height:38px; border-radius:12px; font-size:15px; box-shadow:none; }
.profile-head h2 { margin:0 0 4px; font-size:20px; }
.profile-head .sub { color:var(--muted); font-size:13px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.kv-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px; margin-top:6px; }
.kv-item { background:#f8faff; border:1px solid var(--line); border-radius:12px; padding:12px 14px; }
.kv-item .k { font-size:12px; color:var(--muted); margin-bottom:4px; }
.kv-item .v { font-size:14px; font-weight:600; word-break:break-all; }
.pwd-box { max-width:420px; }
@media(prefers-reduced-motion:reduce) { *,*:before,*:after { transition:none!important; animation:none!important; } }

/* ========== v5 App 化外观 ========== */
:root { --safe-t:env(safe-area-inset-top,0px); --safe-b:env(safe-area-inset-bottom,0px); --brand-2:#6d8dff; }
html { -webkit-text-size-adjust:100%; }
body { overscroll-behavior-y:none; -webkit-font-smoothing:antialiased; }
button,.btn,.sidebar a { user-select:none; -webkit-user-select:none; touch-action:manipulation; }
.btn { background:linear-gradient(135deg,var(--brand),#5077f5); }
.btn:active { transform:scale(.97); }
.btn.gray { background:#eef2f9; } .btn.danger { background:linear-gradient(135deg,#e5484d,#d13438); }
.topbar { position:sticky; top:0; z-index:50; background:#ffffffeb; backdrop-filter:saturate(1.6) blur(14px); }
.card,.stat,.m-card { transition:box-shadow .2s,transform .2s; }
@media(hover:hover){ .stat:hover { transform:translateY(-2px); box-shadow:0 10px 28px #23386310; } }
.toast { top:calc(var(--safe-t) + 14px); border-radius:999px; padding:10px 20px; animation:toastIn .22s ease; }
@keyframes toastIn { from { opacity:0; transform:translate(-50%,-10px); } }
@media(max-width:700px){
  body { background:#f3f6fc; }
  /* 顶栏：渐变 App 标题栏 */
  .topbar { min-height:0; padding:calc(var(--safe-t) + 12px) 16px 12px; flex-wrap:nowrap; background:linear-gradient(135deg,#3a72ff,#1e5cff); border:0; backdrop-filter:none; color:#fff; }
  .topbar .title { font-size:17px; color:#fff; white-space:nowrap; }
  .topbar .user { color:#dbe6ff; font-size:12px; gap:8px; min-width:0; }
  .topbar .user #who { max-width:90px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .topbar .btn.gray { background:#ffffff33; color:#fff; }
  /* 管理/代理侧栏 → 底部标签栏 */
  .layout { display:block; min-height:0; }
  .main { padding:16px 14px calc(78px + var(--safe-b)); }
  .sidebar { position:fixed; left:0; right:0; bottom:0; top:auto; z-index:60; width:auto; display:flex; gap:2px; overflow-x:auto; scrollbar-width:none; padding:6px 6px calc(var(--safe-b) + 6px); background:#fff; border:0; border-top:1px solid var(--line); box-shadow:0 -4px 18px #1828440f; }
  .sidebar::-webkit-scrollbar { display:none; }
  .sidebar a { flex:0 0 auto; min-width:68px; text-align:center; font-size:12px; padding:9px 10px; margin:0; border-left:0 !important; border-radius:12px; }
  .sidebar a.active { background:#edf2ff; color:var(--brand); font-weight:700; }
  /* 弹窗 → 底部抽屉 */
  .modal-mask { align-items:flex-end; padding:0; }
  .modal { width:100%; max-width:100%; border-radius:22px 22px 0 0; padding:22px 18px calc(var(--safe-b) + 20px); animation:sheetUp .25s ease; }
  .modal::before { content:''; display:block; width:38px; height:4px; border-radius:4px; background:#d5dcea; margin:-10px auto 14px; }
  .btn { min-height:42px; } .btn.sm { min-height:34px; }
  input,select,textarea { font-size:16px; } /* 避免 iOS 聚焦自动缩放 */
  .toolbar > * { flex:1 1 130px; }
  .pagination { justify-content:space-between; }
}
@keyframes sheetUp { from { transform:translateY(100%); } }
@media(prefers-reduced-motion:reduce){ *,*::before,*::after { animation:none !important; transition:none !important; } }
