/* BitDesk Console —— 独立运营后台样式，与交易前台完全隔离 */

:root {
  --bg: #0d1017;
  --bg-2: #12161f;
  --panel: #161b26;
  --panel-2: #1b2130;
  --panel-3: #222a3b;
  --line: #252d3d;
  --line-soft: #1e2534;
  --text: #e6ebf5;
  --dim: #8b96ab;
  --dim-2: #66718a;
  --brand: #4f7cff;
  --brand-2: #3b66e0;
  --ok: #21c07a;
  --warn: #e8a33d;
  --bad: #ef5f6b;
  --up: #f0616d;
  --down: #21c07a;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
[hidden] { display: none !important; }

/* ================= 登录 ================= */
.auth {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 18% -10%, rgba(79, 124, 255, .18), transparent 60%),
    radial-gradient(700px 400px at 100% 110%, rgba(33, 192, 122, .10), transparent 55%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 386px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 30px 22px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .7);
}

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand h1 { font-size: 17px; letter-spacing: .2px; }
.auth-brand p { margin: 2px 0 0; font-size: 12px; color: var(--dim); }

.logo {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--brand), #7d5cff);
  font-weight: 800; font-size: 18px; color: #fff;
  flex: none;
}

.fld { display: block; margin-bottom: 14px; }
.fld span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 6px; }
.fld input {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; outline: none;
  transition: border-color .15s, background .15s;
}
.fld input:focus { border-color: var(--brand); background: #0f1420; }
.fld input::placeholder { color: var(--dim-2); }

.auth-err {
  background: rgba(239, 95, 107, .1);
  border: 1px solid rgba(239, 95, 107, .35);
  color: #ff98a1;
  font-size: 12.5px;
  padding: 8px 11px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.btn {
  height: 34px; padding: 0 14px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px; font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { background: transparent; border-color: rgba(239, 95, 107, .5); color: #ff8a93; }
.btn.danger:hover { background: rgba(239, 95, 107, .12); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { height: 23px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }
.btn.block { width: 100%; height: 40px; font-size: 14px; }

.auth-foot {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--dim-2);
}
.auth-foot a { color: var(--brand); }
.auth-foot a:hover { text-decoration: underline; }

/* ================= 骨架 ================= */
.shell {
  display: grid;
  grid-template-columns: 218px 1fr;
  min-height: 100vh;
}

.side {
  background: var(--bg-2);
  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 16px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.side-brand .logo { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
.side-brand-txt { display: flex; flex-direction: column; line-height: 1.25; }
.side-brand-txt b { font-size: 14px; }
.side-brand-txt i { font-style: normal; font-size: 10.5px; color: var(--dim-2); letter-spacing: 1.4px; text-transform: uppercase; }

.menu { padding: 10px 8px; flex: 1; overflow-y: auto; }
.menu a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; margin-bottom: 2px;
  border-radius: 8px;
  color: var(--dim);
  font-size: 13.5px;
  cursor: pointer;
  position: relative;
  transition: background .14s, color .14s;
}
.menu a em { font-style: normal; width: 16px; text-align: center; opacity: .8; font-size: 13px; }
.menu a:hover { background: var(--panel-2); color: var(--text); }
.menu a.active { background: rgba(79, 124, 255, .14); color: #b9caff; }
.menu a.active em { opacity: 1; color: var(--brand); }
.menu a .dot {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, .16);
}

.side-foot { padding: 12px; border-top: 1px solid var(--line-soft); }
.who { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel-3); color: #b9caff;
  font-size: 12.5px; font-weight: 600; flex: none;
}
.who b { display: block; font-size: 13px; font-weight: 500; }
.who i { display: block; font-style: normal; font-size: 11px; color: var(--dim-2); }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 58px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 16, 23, .86);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 15.5px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.pill {
  font-size: 11.5px; padding: 3px 9px; border-radius: 20px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--dim);
}
.pill.live { color: #7ee2b0; border-color: rgba(33, 192, 122, .35); background: rgba(33, 192, 122, .1); }
.pill.delayed { color: #f3c47b; border-color: rgba(232, 163, 61, .35); background: rgba(232, 163, 61, .1); }

.view { padding: 18px 22px 40px; min-width: 0; }
.view > .stack { display: flex; flex-direction: column; gap: 14px; }

/* ================= 通用组件 ================= */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  font-size: 13.5px; font-weight: 600;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, .018), transparent);
}
.panel-hd .spacer { flex: 1; }
.panel-hd .hint { font-weight: 400; font-size: 12px; color: var(--dim-2); }
.panel-bd { padding: 16px; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
}
.card .k { font-size: 12px; color: var(--dim); }
.card .v { font-size: 24px; font-weight: 650; letter-spacing: -.4px; margin: 6px 0 3px; font-variant-numeric: tabular-nums; }
.card .s { font-size: 11.5px; color: var(--dim-2); }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-2);
}
.toolbar input, .toolbar select {
  height: 32px; padding: 0 10px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px;
  font-size: 13px; font-family: inherit; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--brand); }
.toolbar input.search { width: 220px; }
.toolbar .spacer { flex: 1; }

table.grid { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.grid th {
  text-align: right; font-weight: 500; color: var(--dim);
  padding: 9px 12px; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap; background: var(--panel);
  position: sticky; top: 0; z-index: 2;
}
table.grid td {
  text-align: right; padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid th:last-child, table.grid td:last-child { text-align: right; }
table.grid tbody tr:hover { background: var(--panel-2); }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid td.dim, table.grid th.dim { color: var(--dim); }
table.grid td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--dim); }
table.grid td.empty, table.grid td .empty { color: var(--dim-2); }
td.empty-cell { text-align: center !important; color: var(--dim-2); padding: 34px 0 !important; }

.ops { display: flex; gap: 5px; justify-content: flex-end; align-items: center; }

.badge {
  display: inline-block; padding: 1.5px 7px; border-radius: 5px;
  font-size: 11px; line-height: 1.55; font-weight: 500;
}
.badge.ok { background: rgba(33, 192, 122, .14); color: #6fe0aa; }
.badge.warn { background: rgba(232, 163, 61, .14); color: #f0bd77; }
.badge.bad { background: rgba(239, 95, 107, .14); color: #ff8a93; }
.badge.off { background: var(--panel-3); color: var(--dim); }
.badge.admin { background: rgba(79, 124, 255, .16); color: #a9c0ff; }

.up { color: var(--up); }
.down { color: var(--down); }
.dim { color: var(--dim); }
.dim2 { color: var(--dim-2); }
.pos { color: var(--up); }
.neg { color: var(--down); }

.pager {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--dim);
}
.pager .spacer { flex: 1; }

.bars { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 48px 1fr 84px 96px; gap: 10px; align-items: center; font-size: 12px; }
.bar-row .d { color: var(--dim); font-variant-numeric: tabular-nums; }
.bar-row .track { height: 7px; background: var(--panel-3); border-radius: 4px; overflow: hidden; }
.bar-row .track i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), #7d5cff); }
.bar-row .v { text-align: right; font-variant-numeric: tabular-nums; }
.bar-row .n { text-align: right; color: var(--dim-2); font-size: 11px; }

/* 设置表单 */
.form { padding: 16px; max-width: 760px; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 14px;
}
.field > .lbl { grid-column: 1 / -1; display: block; font-size: 12px; color: var(--dim); margin-bottom: 6px; }
.field input[type=text], .field input[type=password], .field input[type=number], .field select, .field input:not([type]) {
  height: 36px; padding: 0 11px; min-width: 0;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; outline: none;
  grid-column: 1; width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--brand); }
.field .unit { grid-column: 2; align-self: center; margin-left: 8px; font-size: 12px; color: var(--dim-2); white-space: nowrap; }
.field.short { grid-template-columns: auto auto; justify-content: start; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); margin: 0 0 12px; cursor: pointer; }
.chk input { width: 15px; height: 15px; accent-color: var(--brand); margin: 0; }

/* 弹窗 */
.modal-host {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6, 9, 14, .72);
  display: grid; place-items: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal {
  width: 100%; max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .8);
}
.modal h3 { font-size: 15px; margin-bottom: 4px; }
.modal .sub { font-size: 12px; color: var(--dim); margin-bottom: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* 提示 */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-3); border: 1px solid var(--line);
  color: var(--text); font-size: 13px;
  padding: 9px 14px; border-radius: 9px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .6);
  animation: tin .18s ease-out;
}
.toast.ok { border-color: rgba(33, 192, 122, .45); }
.toast.err { border-color: rgba(239, 95, 107, .5); color: #ffb3b9; }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }

/* 空状态 */
.blank { padding: 46px 0; text-align: center; color: var(--dim-2); font-size: 13px; }

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .side-brand { border: 0; padding: 10px 12px; }
  .menu { display: flex; padding: 8px; }
  .menu a span { display: none; }
  .side-foot { border: 0; padding: 8px 12px; }
  .who { margin: 0; }
  .who div, #btnLogout { display: none; }
  .cards { grid-template-columns: 1fr; }
  .form .row2 { grid-template-columns: 1fr; }
  .view { padding: 12px; }
}
