/* 皖美电竞管理后台 · 全局样式 */
:root {
  --primary: #6a5cff;
  --primary-dark: #5245e0;
  --primary-light: #edeaff;
  --accent: #38d9f5;
  --bg: #f2f4fa;
  --card: #ffffff;
  --text: #232838;
  --text-2: #6b7285;
  --text-3: #9aa2b1;
  --border: #e6e9f2;
  --danger: #f0445c;
  --warn: #f5a623;
  --ok: #23bf87;
  --sidebar: #191d2b;
  --sidebar-active: #24293d;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(35, 40, 56, .06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

/* ===== 登录页 ===== */
.login-wrap {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 15% 10%, rgba(106, 92, 255, .35), transparent 55%),
              radial-gradient(900px 500px at 85% 90%, rgba(56, 217, 245, .3), transparent 55%),
              #14172a;
}
.login-card {
  width: 400px; background: rgba(255, 255, 255, .98); border-radius: 18px;
  padding: 42px 40px 36px; box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-logo .badge {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-size: 22px; font-weight: 800;
}
.login-logo h1 { font-size: 22px; }
.login-sub { color: var(--text-3); margin-bottom: 28px; font-size: 13px; }
.login-card .field { margin-bottom: 16px; }
.login-tip {
  margin-top: 18px; padding: 10px 12px; background: var(--primary-light);
  border-radius: 8px; color: var(--primary-dark); font-size: 12px; line-height: 1.7;
}

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--sidebar); color: #c8cde0; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07); margin-bottom: 10px;
}
.sidebar .brand .badge {
  width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-weight: 800; font-size: 17px;
}
.sidebar .brand b { color: #fff; font-size: 16px; letter-spacing: .5px; }
.sidebar .brand small { display: block; color: #8a90a8; font-size: 11px; margin-top: 1px; }
.menu { flex: 1; padding: 4px 10px; overflow-y: auto; }
.menu-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px;
  cursor: pointer; margin-bottom: 3px; color: #aab0c6; transition: all .15s; font-size: 13.5px;
}
.menu-item .ico { width: 20px; text-align: center; font-size: 15px; }
.menu-item:hover { background: var(--sidebar-active); color: #fff; }
.menu-item.active { background: linear-gradient(90deg, var(--primary), #7f6bff); color: #fff; box-shadow: 0 4px 14px rgba(106, 92, 255, .35); }
.menu-item .cnt {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 11px;
  border-radius: 9px; padding: 1px 7px; font-weight: 600;
}
.sidebar .foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.07); font-size: 12px; color: #8a90a8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--card); display: flex; align-items: center;
  padding: 0 24px; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-size: 17px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .who { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; }
.topbar .who .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.topbar .role-tag { background: var(--primary-light); color: var(--primary-dark); padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.content { padding: 22px 24px 40px; }

/* ===== 通用组件 ===== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.card-title::before { content: ''; width: 4px; height: 15px; border-radius: 2px; background: linear-gradient(180deg, var(--primary), var(--accent)); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

.btn {
  border: none; border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: 13px;
  background: var(--primary); color: #fff; transition: all .15s; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; border: 1px solid var(--border); color: var(--text-2); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); background: #fff; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #d3364d; }
.btn.ok { background: var(--ok); }
.btn.ok:hover { background: #1da673; }
.btn.warn { background: var(--warn); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .select, .textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px;
  background: #fff; color: var(--text); outline: none; transition: border .15s; font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(106, 92, 255, .12); }
.input.block, .select.block, .textarea.block { width: 100%; }
.textarea { resize: vertical; min-height: 90px; line-height: 1.7; }

.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field .req::after { content: ' *'; color: var(--danger); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  text-align: left; font-size: 12px; color: var(--text-3); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: #fafbfe;
}
table.grid td { padding: 12px; border-bottom: 1px solid #f0f2f8; font-size: 13px; vertical-align: middle; }
table.grid tr:hover td { background: #f8f9ff; }
table.grid .thumb { width: 74px; height: 42px; object-fit: cover; border-radius: 6px; display: block; background: #eef0f7; }
table.grid .avatar-sm { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #eef0f7; }
.cell-main { font-weight: 600; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag.blue { background: #e8f1ff; color: #2f6fed; }
.tag.purple { background: var(--primary-light); color: var(--primary-dark); }
.tag.green { background: #e2f8ef; color: #17966a; }
.tag.orange { background: #fff2df; color: #d07c00; }
.tag.red { background: #ffe7ec; color: #d3364d; }
.tag.gray { background: #eef0f5; color: var(--text-2); }
.tag.cyan { background: #dff7fd; color: #0f97b5; }

.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 16px; font-size: 13px; color: var(--text-2); }
.pager button {
  border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 5px 11px;
  cursor: pointer; color: var(--text-2); font-size: 13px;
}
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

.empty { text-align: center; color: var(--text-3); padding: 46px 0; font-size: 13px; }
.empty::before { content: '📭'; display: block; font-size: 34px; margin-bottom: 10px; }

/* 统计卡片 */
.stat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; position: relative; overflow: hidden; }
.stat-card .num { font-size: 28px; font-weight: 800; letter-spacing: .5px; }
.stat-card .lbl { color: var(--text-3); font-size: 12.5px; margin-top: 4px; }
.stat-card .ico {
  position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.grid-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.rank-list { list-style: none; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #eef0f6; }
.rank-list li:last-child { border-bottom: none; }
.rank-no {
  width: 22px; height: 22px; border-radius: 6px; background: #eef0f5; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.rank-list li:nth-child(1) .rank-no { background: #ffd166; color: #7a5200; }
.rank-list li:nth-child(2) .rank-no { background: #dfe6f5; color: #55618a; }
.rank-list li:nth-child(3) .rank-no { background: #ffd9c2; color: #a04d16; }
.rank-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { color: var(--primary); font-weight: 700; font-size: 13px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 23, 42, .55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 30px;
  animation: fadeIn .18s ease;
}
.modal {
  background: #fff; border-radius: 14px; width: 640px; max-width: 100%; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: 0 26px 70px rgba(0, 0, 0, .3);
  animation: popIn .2s ease;
}
.modal.narrow { width: 440px; }
.modal.wide { width: 860px; }
.modal-head { display: flex; align-items: center; padding: 18px 22px 0; }
.modal-head b { font-size: 16px; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--text-3); font-size: 20px; line-height: 1; padding: 4px; }
.modal-head .x:hover { color: var(--danger); }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--border); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { transform: scale(.96) translateY(8px); opacity: 0; } }

/* Toast */
#toast-root { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: #232838; color: #fff; border-radius: 10px; padding: 11px 22px; font-size: 13.5px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .25); animation: toastIn .25s ease; max-width: 70vw;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
@keyframes toastIn { from { transform: translateY(-16px); opacity: 0; } }

/* 上传缩略 */
.upload-box { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.upload-box .preview {
  width: 150px; height: 84px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); background: #f4f5fa;
}
.switch { position: relative; width: 42px; height: 23px; cursor: pointer; display: inline-block; vertical-align: middle; }
.switch input { display: none; }
.switch i {
  position: absolute; inset: 0; background: #d6dae6; border-radius: 12px; transition: all .2s;
}
.switch i::after {
  content: ''; position: absolute; width: 17px; height: 17px; background: #fff; border-radius: 50%;
  top: 3px; left: 3px; transition: all .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { left: 22px; }

.perm-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.perm-grid label {
  display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; cursor: pointer; font-size: 13px; color: var(--text-2);
}
.perm-grid label:has(input:checked) { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-light); }

.banner-row { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.banner-row img { width: 130px; height: 62px; object-fit: cover; border-radius: 8px; background: #eef0f7; }
.banner-row .info { flex: 1; min-width: 0; }
.banner-row .info b { display: block; margin-bottom: 3px; }
.banner-row .info small { color: var(--text-3); word-break: break-all; }

.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.category-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.category-panel { border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.category-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.category-panel-head span { color: var(--text-3); font-size: 12px; margin-left: 8px; }
.category-list { display: flex; flex-direction: column; gap: 8px; }
.category-row { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 7px 8px; border-radius: 8px; background: #f8f9fc; }
.category-row b { flex: 1; font-size: 13px; }
.empty.compact { padding: 18px 0; }
.empty.compact::before { display: none; }

.checkbox { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

@media (max-width: 1100px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .form-grid, .category-columns { grid-template-columns: 1fr; }
}

/* ===== 赛程管理（schedule） ===== */
.sch-board { display: flex; gap: 18px; overflow-x: auto; padding: 6px 2px 12px; }
.sch-col { min-width: 230px; display: flex; flex-direction: column; gap: 12px; justify-content: space-around; }
.sch-col-title { font-weight: 600; color: var(--text-2); font-size: 13px; padding: 2px 4px; }
.sch-match { background: var(--bg-2, #f7f8fa); border: 1px solid var(--line, #e5e7eb); border-radius: 10px; padding: 8px 10px; }
.sch-side { display: flex; justify-content: space-between; align-items: center; padding: 5px 6px; border-radius: 6px; }
.sch-side .nm { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sch-side .sc { min-width: 22px; text-align: right; }
.sch-side.win { background: rgba(34, 197, 94, .12); }
.sch-side.win .nm { font-weight: 600; }
.sch-ops { display: flex; gap: 6px; align-items: center; margin-top: 6px; justify-content: flex-end; }
.sch-rank { display: flex; flex-direction: column; gap: 4px; padding: 10px 18px; border-radius: 10px; background: var(--bg-2, #f7f8fa); border: 1px solid var(--line, #e5e7eb); }
.sch-rank.r1 { border-color: #f59e0b; background: rgba(245, 158, 11, .1); }
.sch-rank.r2 { border-color: #94a3b8; background: rgba(148, 163, 184, .12); }
.sch-rank.r3 { border-color: #b45309; background: rgba(180, 83, 9, .08); }
