:root {
  --bg: #0A0C0E;
  --side: #0D1013;
  --panel: #12161A;
  --panel2: #171C21;
  --line: #22282E;
  --text: #EEF1F3;
  --muted: #93A0A8;
  --dim: #64717A;
  --ok: #3DDC97;
  --warn: #F5B547;
  --err: #F87171;
  --r: 13px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
.hide { display: none !important; }

/* ================= 登录页 ================= */
.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(900px 500px at 50% -10%, rgba(255,255,255,.05), transparent 70%), var(--bg);
}

.card {
  width: 100%; max-width: 392px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 30px 26px;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand svg { width: 36px; height: 36px; flex: none; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: .3px; }
.brand-sub { font-size: 12px; color: var(--dim); margin-top: 2px; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }

input[type=text], input[type=password] {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  font-size: 14.5px;
  outline: none;
  transition: border-color .15s, background .15s;
}
input:focus { border-color: #3A4149; background: #1B2024; }
input::placeholder { color: #5C6469; }

.btn {
  width: 100%; height: 47px; border: 0; border-radius: 11px;
  background: #EEF1F3; color: #0A0C0E;
  font-size: 15px; font-weight: 650; cursor: pointer; margin-top: 8px;
  transition: opacity .15s, transform .06s;
}
.btn:hover { opacity: .9; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: default; }

.msg { min-height: 20px; font-size: 13px; margin-top: 12px; color: var(--err); line-height: 1.5; }

.hint {
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--dim); line-height: 1.8;
}
.hint b { color: var(--muted); font-weight: 600; }

/* ================= 控制台骨架 ================= */
.shell { display: flex; min-height: 100%; }

/* 左侧栏 */
.side {
  width: 210px; flex: none;
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
}
.side-brand svg { width: 28px; height: 28px; flex: none; }
.side-brand .n { font-size: 15px; font-weight: 700; letter-spacing: .2px; }

.nav { padding: 6px 10px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  height: 40px; padding: 0 11px; margin-bottom: 2px;
  border-radius: 9px;
  font-size: 13.5px; color: var(--muted);
  transition: .13s;
}
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.nav a:hover { background: #14191E; color: var(--text); }
.nav a.on { background: #182027; color: var(--text); font-weight: 560; }
.nav a.on svg { opacity: 1; color: var(--ok); }
.nav a.on::before {
  content: ''; position: absolute; left: 0; width: 2px; height: 18px;
  background: var(--ok); border-radius: 2px;
}

.side-foot { padding: 12px 14px 16px; border-top: 1px solid var(--line); }
.side-foot .who { font-size: 12px; color: var(--dim); margin-bottom: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot button {
  width: 100%; height: 34px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent;
  color: var(--muted); font-size: 12.5px; cursor: pointer;
}
.side-foot button:hover { color: var(--text); border-color: #39424A; }

/* 右侧主体 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 58px; flex: none;
  display: flex; align-items: center; justify-content: flex-end;
  gap: 14px; padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,12,14,.9);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 5;
}

.pill {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; font-size: 12.5px; color: var(--muted);
}
.pill b { color: var(--ok); font-size: 13.5px; font-weight: 650; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #1D262C; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; color: var(--muted); font-weight: 600;
}

.content { padding: 24px 26px 60px; }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 19px; font-weight: 680; letter-spacing: -.2px; }
.page-head p { font-size: 12.5px; color: var(--dim); margin-top: 5px; }

/* 统计卡 */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }

.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 15px 17px;
  position: relative; overflow: hidden;
}
.stat .lab {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--dim); margin-bottom: 10px;
}
.stat .lab i { width: 14px; height: 14px; display: inline-flex; }
.stat .lab i svg { width: 14px; height: 14px; color: var(--dim); }
.stat .val { font-size: 23px; font-weight: 680; letter-spacing: -.5px; color: var(--ok); line-height: 1.1; }
.stat .val.small { font-size: 19px; }
.stat .sub { font-size: 11.5px; color: var(--dim); margin-top: 7px; }

/* 工具条 */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 11px 15px; margin-bottom: 12px;
}
.toolbar .sp { flex: 1; }
.seg { display: flex; gap: 4px; background: #0E1216; border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg button {
  height: 27px; padding: 0 11px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 12px; cursor: pointer;
}
.seg button.on { background: #1E262C; color: var(--text); }

.mini-btn {
  height: 31px; padding: 0 13px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel2);
  color: var(--muted); font-size: 12.5px; cursor: pointer;
}
.mini-btn:hover { color: var(--text); border-color: #39424A; }

/* 图表/面板 */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
}
.panel + .panel { margin-top: 12px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 17px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 13.5px; font-weight: 620; }
.panel-head .r { font-size: 12px; color: var(--dim); }
.panel-body { padding: 16px 17px; }

.two { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; }

.empty {
  text-align: center; padding: 44px 0 38px;
  color: var(--dim); font-size: 13px; line-height: 1.9;
}
.empty .ico {
  width: 46px; height: 46px; margin: 0 auto 14px;
  border: 1px solid var(--line); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #39424A;
}

/* 柱状图 */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 8px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .bar {
  width: 100%; max-width: 34px; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #35D6A4, #1D8E6C);
  min-height: 3px; transition: height .4s;
}
.bars .bar.zero { background: #1B2228; }
.bars .cap { font-size: 10.5px; color: var(--dim); white-space: nowrap; }

/* 横向条 */
.rows { display: flex; flex-direction: column; gap: 13px; }
.row-item .top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.row-item .top span:last-child { color: var(--muted); }
.row-item .track { height: 6px; background: #171D22; border-radius: 4px; overflow: hidden; }
.row-item .fill { height: 100%; background: linear-gradient(90deg, #2AAE86, #3DDC97); border-radius: 4px; }

/* 表格 */
.tw { overflow-x: auto; overflow-y: hidden; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11.5px; font-weight: 500; color: var(--dim);
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { font-size: 13px; padding: 12px 14px; border-bottom: 1px solid #1A2025; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #14191D; }
td.mono, .mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; }
td.num { font-variant-numeric: tabular-nums; color: var(--ok); }

.tag { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: rgba(61,220,151,.12); color: var(--ok); }
.tag.off { background: rgba(147,160,168,.12); color: var(--muted); }

.act { display: flex; gap: 6px; }
.act button {
  height: 27px; padding: 0 9px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--panel2);
  color: var(--muted); font-size: 11.5px; cursor: pointer;
}
.act button:hover { color: var(--text); border-color: #39424A; }
.act button.danger:hover { color: var(--err); border-color: rgba(248,113,113,.4); }

.base-url {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 13px; margin-bottom: 14px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; color: #C7D0D6;
}
.base-url span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.quick { display: flex; flex-direction: column; gap: 9px; }
.quick a {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: 10px;
  background: var(--panel2); border: 1px solid var(--line);
  transition: .13s;
}
.quick a:hover { border-color: #39424A; background: #1A2026; }
.quick .ico {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: #1F2A24; color: var(--ok);
  display: flex; align-items: center; justify-content: center;
}
.quick .ico.blue { background: #1D2733; color: #6BB8F5; }
.quick .ico.amber { background: #2E2718; color: var(--warn); }
.quick .t { font-size: 13px; font-weight: 560; }
.quick .d { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.quick .arrow { margin-left: auto; color: #39424A; }

.redeem-box { max-width: 520px; }
.redeem-big {
  background: linear-gradient(135deg, #14322A, #0E2A24);
  border: 1px solid #1E4A3D; border-radius: 14px;
  padding: 22px 24px; margin-bottom: 16px;
}
.redeem-big .k { font-size: 12px; color: #7FBFA8; }
.redeem-big .v { font-size: 30px; font-weight: 700; margin-top: 8px; letter-spacing: -.6px; }
.redeem-line { display: flex; gap: 10px; }
.redeem-line input { flex: 1; }
.redeem-line .btn { width: auto; margin: 0; padding: 0 24px; height: 46px; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 12px 16px; font-size: 13px; }
.kv dt { color: var(--dim); }
.kv dd { color: var(--text); }

.banner {
  display: flex; align-items: center; gap: 10px;
  background: rgba(245,181,71,.08);
  border: 1px solid rgba(245,181,71,.25);
  color: #E8C48C; border-radius: 10px;
  padding: 11px 15px; font-size: 12.5px; margin-bottom: 14px;
}
.banner a { color: var(--warn); text-decoration: underline; cursor: pointer; }

.skel { color: var(--dim); font-size: 13px; padding: 18px 0; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 32px;
  transform: translateX(-50%) translateY(12px);
  background: #EEF1F3; color: #0A0C0E;
  font-size: 13px; font-weight: 600;
  padding: 10px 19px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: .18s; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ================= 列表页通用 ================= */
.head-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.act-row { display: flex; gap: 8px; flex: none; }

.btn-sm {
  height: 34px; padding: 0 13px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel2);
  color: var(--muted); font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm:hover { color: var(--text); border-color: #39424A; }
.btn-sm.primary {
  background: #EEF1F3; color: #0A0C0E; border-color: #EEF1F3; font-weight: 600;
}
.btn-sm.primary:hover { opacity: .9; }

.filters { display: flex; gap: 9px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input[type=text] { height: 38px; max-width: 280px; }
.filters select, .sel {
  height: 38px; padding: 0 32px 0 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); font-size: 13px; outline: none; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364717A' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.filters select:hover { border-color: #39424A; }

.endpoint {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; margin-bottom: 12px;
  font-size: 12.5px;
}
.endpoint .lbl { color: var(--dim); flex: none; }
.endpoint .url {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  color: #C7D0D6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.endpoint .ico-btn {
  width: 24px; height: 24px; border: 0; border-radius: 6px;
  background: transparent; color: var(--dim); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.endpoint .ico-btn:hover { background: #1E262C; color: var(--text); }
.endpoint .ico-btn svg { width: 14px; height: 14px; }
.endpoint .res { font-size: 12px; margin-left: 2px; }
.endpoint .res.ok { color: var(--ok); }
.endpoint .res.bad { color: var(--err); }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--muted); }
th .ar { opacity: .35; margin-left: 3px; font-size: 10px; }
th .ar.on { opacity: 1; color: var(--ok); }

.col-wrap { position: relative; }
.col-menu {
  position: absolute; right: 0; top: 42px; z-index: 30;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px; min-width: 156px;
  box-shadow: 0 14px 34px rgba(0,0,0,.5);
}
.col-menu label {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 6px;
  font-size: 12.5px; color: var(--muted); cursor: pointer;
}
.col-menu label:hover { background: #1A2026; color: var(--text); }
.col-menu input { width: 13px; height: 13px; accent-color: #3DDC97; }

/* 移动端 */
@media (max-width: 900px) {
  .grid4 { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .side {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0;
    width: 100%; height: 58px; flex-direction: row; align-items: center;
    border-right: 0; border-top: 1px solid var(--line); z-index: 40;
  }
  .side-brand, .side-foot { display: none; }
  .nav { display: flex; padding: 4px 6px; overflow-x: auto; }
  .nav a { flex-direction: column; gap: 3px; height: 48px; padding: 6px 10px; font-size: 10.5px; }
  .nav a.on::before { display: none; }
  .content { padding: 16px 14px 90px; }
  .topbar { padding: 0 14px; }
  .grid4 { grid-template-columns: repeat(2, 1fr); }
  .stat .val { font-size: 18px; }
  .page-head h1 { font-size: 17px; }
  table { display: block; overflow-x: auto; }
}
