/* 桐子哥山桐子 · 设计系统 */
:root {
  --bg: #080c17;
  --bg-soft: #0d1322;
  --panel: rgba(20, 27, 45, 0.82);
  --panel-solid: #141b2d;
  --panel-2: rgba(30, 39, 62, 0.7);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eaf0ff;
  --text-2: #a8b3cc;
  --text-3: #6b7793;
  --primary: #3b82f6;
  --primary-2: #60a5fa;
  --accent: #8b5cf6;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --pink: #ec4899;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  --font: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(1100px 620px at 12% -10%, rgba(59, 130, 246, 0.18), transparent 60%),
    radial-gradient(900px 520px at 92% 6%, rgba(139, 92, 246, 0.16), transparent 62%);
  background-attachment: fixed;
}

a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); }

/* ---------------------------------- 布局 ---------------------------------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px;
  flex: 0 0 224px;
  background: linear-gradient(180deg, rgba(17, 23, 40, 0.96), rgba(9, 13, 24, 0.96));
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; font-size: 17px;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
}
.brand-name { font-weight: 700; letter-spacing: 0.4px; }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.nav-group-title { font-size: 11px; color: var(--text-3); padding: 14px 10px 6px; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer; font-size: 13px;
  transition: all 0.16s ease; border: 1px solid transparent;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(139, 92, 246, 0.12));
  border-color: rgba(96, 165, 250, 0.35);
  color: #fff; font-weight: 600;
}
.nav-item .ico { width: 18px; text-align: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px; flex: 0 0 62px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 26, 0.72);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 650; }
.topbar .sub { font-size: 12px; color: var(--text-3); }
.topbar .spacer { flex: 1; }

.content { padding: 20px 22px 40px; flex: 1; }

/* ---------------------------------- 组件 ---------------------------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 650; }
.card-head .spacer { flex: 1; }
.card-sub { font-size: 12px; color: var(--text-3); }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1200px) {
  .grid.cols-4, .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.22), transparent 70%);
}
.stat .label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: 0.5px; font-variant-numeric: tabular-nums; }
.stat .value.small { font-size: 20px; }
.stat .foot { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.stat .up { color: var(--success); }
.stat .down { color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.06);
  color: var(--text); font-size: 13px; font-family: var(--font);
  transition: all 0.16s ease; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--accent)); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: rgba(239, 68, 68, 0.16); border-color: rgba(239, 68, 68, 0.45); color: #fca5a5; }
.btn.danger:hover { background: rgba(239, 68, 68, 0.28); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text-2); }
.btn.ghost:hover { color: var(--text); border-color: var(--line-strong); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.warn { background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.42); color: #fcd34d; }
.btn.success { background: rgba(34, 197, 94, 0.16); border-color: rgba(34, 197, 94, 0.42); color: #86efac; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px;
  background: rgba(255, 255, 255, 0.08); color: var(--text-2);
  border: 1px solid var(--line);
}
.badge.blue { background: rgba(59, 130, 246, 0.16); color: #93c5fd; border-color: rgba(59, 130, 246, 0.32); }
.badge.green { background: rgba(34, 197, 94, 0.16); color: #86efac; border-color: rgba(34, 197, 94, 0.32); }
.badge.red { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border-color: rgba(239, 68, 68, 0.32); }
.badge.orange { background: rgba(245, 158, 11, 0.16); color: #fcd34d; border-color: rgba(245, 158, 11, 0.32); }
.badge.purple { background: rgba(139, 92, 246, 0.18); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.32); }
.badge.gray { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; }

.dot-live {
  width: 7px; height: 7px; border-radius: 50%; background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65); }
  70% { box-shadow: 0 0 0 9px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

input, select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: rgba(9, 13, 24, 0.75);
  color: var(--text); font-size: 13px; font-family: var(--font); outline: none;
  transition: border-color 0.16s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { resize: vertical; min-height: 68px; }
label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; color: var(--text-2); }
.switch input { display: none; }
.switch .track {
  width: 40px; height: 22px; border-radius: 999px; background: rgba(255, 255, 255, 0.14);
  position: relative; transition: background 0.2s ease;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform 0.2s ease;
}
.switch input:checked + .track { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.switch input:checked + .track::after { transform: translateX(18px); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  padding: 9px 14px; cursor: pointer; color: var(--text-2); font-size: 13px;
  border-bottom: 2px solid transparent; transition: all 0.16s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-bottom-color: var(--primary); font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 9px 10px; color: var(--text-3); font-weight: 500;
  font-size: 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; background: var(--panel-solid); z-index: 1;
}
td { padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: var(--text-2); }
tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }
.table-wrap { max-height: 460px; overflow: auto; border-radius: var(--radius-sm); }

.empty { text-align: center; color: var(--text-3); padding: 34px 10px; font-size: 13px; }

.progress { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; transition: width 0.4s ease; }

.thumb {
  width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center;
  font-size: 22px; flex: 0 0 46px; border: 1px solid var(--line);
}
.tone-1 { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.tone-2 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.tone-3 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.tone-4 { background: linear-gradient(135deg, #22c55e, #15803d); }
.tone-5 { background: linear-gradient(135deg, #ec4899, #be185d); }
.tone-6 { background: linear-gradient(135deg, #06b6d4, #0e7490); }
.tone-7 { background: linear-gradient(135deg, #f97316, #c2410c); }
.tone-8 { background: linear-gradient(135deg, #6366f1, #4338ca); }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; color: #fff; flex: 0 0 28px; font-weight: 600;
}

.modal-mask {
  position: fixed; inset: 0; background: rgba(4, 7, 14, 0.72); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  width: min(560px, 100%); max-height: 86vh; overflow: auto;
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  animation: pop 0.18s ease;
}
@keyframes pop { from { transform: translateY(10px) scale(0.98); opacity: 0; } }
.modal h3 { margin: 0 0 14px; font-size: 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

#toast-host { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 14px; border-radius: 10px; font-size: 13px; min-width: 180px;
  background: rgba(20, 27, 45, 0.96); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); animation: slide 0.2s ease;
}
.toast.success { border-color: rgba(34, 197, 94, 0.5); }
.toast.warn { border-color: rgba(245, 158, 11, 0.5); }
.toast.error { border-color: rgba(239, 68, 68, 0.5); }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }

.chart { width: 100%; height: 200px; display: block; }

.kv { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed rgba(255, 255, 255, 0.07); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-3); }
.kv .v { color: var(--text); font-variant-numeric: tabular-nums; }

.scroll-list { max-height: 340px; overflow-y: auto; padding-right: 4px; }

.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-3); }
.tiny { font-size: 11px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.nowrap { white-space: nowrap; }

/* 登录门 */
.gate {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(900px 500px at 50% 0%, rgba(59, 130, 246, 0.16), transparent 65%), var(--bg);
  z-index: 90;
}
.gate .modal { width: min(400px, 100%); }
.gate .hint { font-size: 12px; color: var(--text-3); margin-top: 12px; line-height: 1.7; }
