:root {
  --bg: #070c16;
  --bg-2: #0b1322;
  --panel: #0f1a2c;
  --panel-2: #111f35;
  --border: #223147;
  --border-soft: rgba(148, 163, 184, 0.12);
  --text: #e8eef8;
  --dim: #93a2b8;
  --dim-2: #66758d;
  --blue: #60a5fa;
  --amber: #f59e0b;
  --red: #ef4444;
  --green: #34d399;
  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui,
    -apple-system, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1000px 620px at 92% -12%, rgba(245, 158, 11, 0.08), transparent 58%),
    radial-gradient(900px 620px at 2% 0%, rgba(59, 130, 246, 0.09), transparent 56%),
    var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 78%);
}

/* ---------------- 品牌 / 按钮 ---------------- */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand img {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
  line-height: 1.25;
}

.brand p {
  margin: 2px 0 0;
  color: var(--dim-2);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 26, 44, 0.85);
  color: #d8e2f0;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
}

.btn:hover {
  border-color: #34475f;
  background: #17263c;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
.input:focus-visible,
.select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.btn-primary {
  border-color: #3b82f6;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover {
  border-color: #60a5fa;
  background: linear-gradient(180deg, #4f8df8, #2f6fe8);
}

.btn-sm {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 11px;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--dim);
}

.btn-ghost:hover {
  border-color: var(--border-soft);
  background: rgba(148, 163, 184, 0.07);
  color: var(--text);
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim-2);
  vertical-align: 1px;
}

.dot.ok {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.dot.warn {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.dot.err {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

/* ---------------- 登录 ---------------- */
.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(500px 220px at 100% 0%, rgba(245, 158, 11, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(20, 33, 55, 0.98), rgba(10, 17, 30, 0.99));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.5);
}

.brand-login img {
  width: 46px;
  height: 46px;
  flex-basis: 46px;
}

.brand-login h1 {
  font-size: 20px;
}

.login-copy {
  margin: 26px 0 20px;
}

.login-copy h2 {
  margin: 0 0 7px;
  font-size: 23px;
  letter-spacing: -0.02em;
}

.login-copy p {
  margin: 0;
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.8;
}

.login-form label {
  display: block;
  margin-bottom: 6px;
  color: var(--dim);
  font-size: 11px;
}

.login-input-row {
  display: flex;
  gap: 8px;
}

.input,
.select {
  height: 37px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: rgba(7, 12, 22, 0.62);
  color: var(--text);
  font-size: 12.5px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.input {
  width: 100%;
  padding: 0 11px;
}

.input::placeholder {
  color: #52627a;
}

.input:focus,
.select:focus {
  border-color: rgba(96, 165, 250, 0.6);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.login-input-row .input {
  flex: 1;
}

.login-error {
  min-height: 18px;
  margin-top: 8px;
  color: #fca5a5;
  font-size: 11.5px;
}

.login-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  color: var(--dim-2);
  font-size: 10.5px;
}

/* ---------------- 顶栏 ---------------- */
.app {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(7, 12, 22, 0.96) 60%, rgba(7, 12, 22, 0));
  backdrop-filter: blur(10px);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 25px;
  padding: 0 9px;
  border: 1px solid rgba(52, 211, 153, 0.18);
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.06);
  color: #a7f3d0;
  font-size: 10px;
  white-space: nowrap;
}

.conn-pill.off {
  border-color: rgba(245, 158, 11, 0.22);
  background: rgba(245, 158, 11, 0.07);
  color: #fcd34d;
}

.updated {
  color: var(--dim-2);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

/* ---------------- Hero ---------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 30px;
  padding: 26px 28px;
  margin: 8px 0 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(700px 260px at 88% 0%, rgba(245, 158, 11, 0.1), transparent 60%),
    linear-gradient(120deg, rgba(24, 40, 66, 0.9), rgba(11, 19, 34, 0.92));
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #fcd34d;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
}

.hero h2 {
  margin: 10px 0 7px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.hero p {
  margin: 0;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.7;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 122px);
  gap: 8px;
}

.stat {
  min-height: 94px;
  padding: 11px 12px;
  border: 1px solid rgba(148, 163, 184, 0.11);
  border-radius: 11px;
  background: rgba(7, 12, 22, 0.34);
}

.stat-label {
  display: block;
  color: var(--dim-2);
  font-size: 10px;
}

.stat-num {
  display: block;
  margin-top: 3px;
  color: #f7fbff;
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.stat-foot {
  display: block;
  margin-top: 2px;
  color: var(--dim-2);
  font-size: 9px;
  white-space: nowrap;
}

.stat-urgent .stat-num {
  color: #f87171;
}

/* ---------------- 面板 ---------------- */
.panel {
  margin-bottom: 16px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 30%),
    rgba(15, 26, 44, 0.84);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.14);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.section-sub {
  margin: 2px 0 0;
  color: var(--dim-2);
  font-size: 10.5px;
}

.account-count {
  margin-left: 4px;
  font-weight: 400;
}

/* ---------------- 账号卡片 ---------------- */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}

.account-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(7, 12, 22, 0.28);
  color: inherit;
  text-align: left;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.12s ease;
}

.account-card:hover {
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(96, 165, 250, 0.055);
}

.account-card.selected {
  border-color: rgba(96, 165, 250, 0.48);
  background: rgba(96, 165, 250, 0.08);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.1);
}

.account-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.account-name {
  overflow: hidden;
  color: #e9eff8;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  color: var(--dim-2);
  font-size: 9px;
}

.account-state.online {
  color: #a7f3d0;
}

.account-state.off {
  color: #fca5a5;
}

.account-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 8px;
}

.account-pending {
  color: #f4f8ff;
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
}

.account-pending small {
  color: var(--dim-2);
  font-family: var(--font);
  font-size: 9px;
  font-weight: 400;
}

.account-wait {
  margin-left: auto;
  color: var(--dim-2);
  font-family: var(--mono);
  font-size: 9.5px;
}

.account-wait.hot {
  color: #fca5a5;
}

.account-card.paused {
  opacity: 0.68;
}

.inline-empty {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 9px;
  color: var(--dim-2);
  font-size: 11px;
  text-align: center;
}

/* ---------------- 工具条 ---------------- */
.table-section-head {
  align-items: center;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-input {
  width: 180px;
}

.select {
  min-width: 112px;
  padding: 0 27px 0 9px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #8998ad 50%),
    linear-gradient(135deg, #8998ad 50%, transparent 50%);
  background-position:
    calc(100% - 13px) 15px,
    calc(100% - 8px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ---------------- 表格 ---------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

th {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 12, 22, 0.4);
  color: var(--dim-2);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.07);
  color: #d6e0ee;
  font-size: 11.5px;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

tbody tr.is-urgent {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.075), transparent 52%);
}

tbody tr.is-warn {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.055), transparent 50%);
}

tbody tr.is-snoozed {
  opacity: 0.6;
}

.col-status {
  width: 90px;
}

.col-wait {
  width: 100px;
}

.col-first {
  width: 92px;
}

.col-action {
  width: 110px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 999px;
  color: var(--dim);
  font-size: 9.5px;
  white-space: nowrap;
}

.status-pill.urgent {
  border-color: rgba(239, 68, 68, 0.26);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.status-pill.warn {
  border-color: rgba(245, 158, 11, 0.24);
  background: rgba(245, 158, 11, 0.08);
  color: #fcd34d;
}

.status-pill.normal {
  border-color: rgba(96, 165, 250, 0.22);
  background: rgba(96, 165, 250, 0.07);
  color: #93c5fd;
}

.status-pill.snoozed {
  color: #94a3b8;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.player-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: #24344d;
  color: #dbe7f5;
  font-size: 11px;
  font-weight: 700;
}

.player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-name {
  overflow: hidden;
  max-width: 260px;
  color: #eef4fc;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.member-name {
  color: #cfdaea;
  font-size: 11px;
}

.member-sub {
  color: var(--dim-2);
  font-size: 9px;
}

.wait-cell {
  color: #b9c8dc;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.is-urgent .wait-cell {
  color: #f87171;
}

.is-warn .wait-cell {
  color: #fbbf24;
}

.first-cell {
  color: var(--dim-2);
  font-family: var(--mono);
  font-size: 9.5px;
  white-space: nowrap;
}

.copy-btn {
  padding: 3px 7px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: transparent;
  color: #93c5fd;
  font-size: 9.5px;
  white-space: nowrap;
}

.copy-btn:hover {
  border-color: rgba(96, 165, 250, 0.34);
  background: rgba(96, 165, 250, 0.08);
}

/* ---------------- 空状态 ---------------- */
.empty-state {
  padding: 42px 18px 38px;
  text-align: center;
}

.empty-radar {
  position: relative;
  width: 52px;
  height: 52px;
  margin: 0 auto 11px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.1), transparent 68%);
}

.empty-radar span {
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(96, 165, 250, 0.13);
  border-radius: 50%;
}

.empty-radar span:nth-child(2) {
  inset: 18px;
}

.empty-radar i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.1);
}

.empty-state h3 {
  margin: 0 0 3px;
  color: #cbd7e8;
  font-size: 12.5px;
}

.empty-state p {
  margin: 0;
  color: var(--dim-2);
  font-size: 10.5px;
}

/* ---------------- 页脚 / Toast ---------------- */
.dash-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 2px 2px 0;
  color: var(--dim-2);
  font-size: 9.5px;
}

.dash-foot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dash-foot b {
  color: #aebdd0;
  font-weight: 500;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 28px));
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #17243a;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  color: #e7ecf5;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.ok {
  border-color: rgba(52, 211, 153, 0.3);
}

.toast.err {
  border-color: rgba(239, 68, 68, 0.35);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .stats {
    grid-template-columns: repeat(4, minmax(100px, 1fr));
  }
}

@media (max-width: 760px) {
  .app {
    width: calc(100% - 24px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 13px 0;
  }

  .topbar-right {
    width: 100%;
    justify-content: flex-start;
  }

  .updated {
    display: none;
  }

  .hero {
    padding: 20px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-head {
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .search-input {
    width: 100%;
  }

  .select {
    flex: 1 1 120px;
  }

  .dash-foot {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 20px;
  }

  .login-input-row {
    flex-direction: column;
  }

  .login-input-row .btn {
    width: 100%;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
