/* stzb Console · 桌面优先，最小宽度 1024 */
:root {
  --bg: #0f1420;
  --bg2: #151b2a;
  --card: #1a2131;
  --line: #263047;
  --txt: #e8edf7;
  --dim: #8d9bb5;
  --dim2: #6b7893;
  --accent: #5b8def;
  --accent2: #3f6fd8;
  --red: #e2564d;
  --red2: #b83c34;
  --green: #39b884;
  --gold: #e0b354;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.boot {
  padding: 80px 0;
  text-align: center;
  color: var(--dim);
}

.layout {
  display: grid;
  grid-template-columns: 216px 1fr;
  min-height: 100vh;
}

/* ---------- 侧栏 ---------- */
.side {
  background: var(--bg2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { padding: 4px 8px 18px; }
.brand-t { font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.brand-s { font-size: 12px; color: var(--dim2); margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--dim);
  font-size: 13.5px;
}
.nav-item:hover { background: #1d2537; color: var(--txt); text-decoration: none; }
.nav-item.on { background: #22304a; color: #fff; font-weight: 600; }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.me-chip { font-size: 12.5px; color: var(--dim); padding: 0 2px; word-break: break-all; }

/* ---------- 主区 ---------- */
.main { min-width: 0; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 32, .9);
  position: sticky;
  top: 0;
  z-index: 5;
}
.page-title { font-size: 17px; margin: 0; font-weight: 650; }
.top-status { font-size: 12.5px; color: var(--dim); }
.view { padding: 20px 28px 60px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card-t { font-size: 13px; color: var(--dim); margin: 0 0 12px; font-weight: 600; letter-spacing: .4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.stat-l { font-size: 12px; color: var(--dim); }
.stat-v { font-size: 22px; font-weight: 700; margin-top: 2px; letter-spacing: .5px; }
.stat-h { font-size: 11.5px; color: var(--dim2); margin-top: 2px; }

.grid { display: flex; flex-direction: column; gap: 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th { color: var(--dim); font-weight: 600; font-size: 12px; white-space: nowrap; }
.table tbody tr:hover { background: #1e2637; }
.table code { font-family: var(--mono); font-size: 12.5px; color: #b9c8e6; }

/* ---------- 通用 ---------- */
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-tight { gap: 4px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-l { font-size: 12px; color: var(--dim); }
.field-h { font-size: 11.5px; color: var(--dim2); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--txt); }

.input {
  background: #121826;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--txt);
  padding: 8px 10px;
  font-size: 13px;
  min-width: 180px;
  outline: none;
}
.input:focus { border-color: var(--accent); }
.input-sm { min-width: 130px; padding: 6px 8px; }
.input-xs { min-width: 100px; padding: 4px 6px; font-size: 12px; }

.btn {
  border: 1px solid var(--line);
  background: #202a3d;
  color: var(--txt);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #273349; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent2); border-color: var(--accent2); }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { background: #3a1f22; border-color: #5b2a2c; color: #ffb4ae; }
.btn-danger:hover { background: #4a2629; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.dim { color: var(--dim); }
.small { font-size: 12px; }
.warn { color: #ffb4ae; }
.error { color: #ff9d95; }
.link { margin-left: 8px; }
.pre {
  background: #101623;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 420px;
  overflow: auto;
}

/* ---------- 提示条 ---------- */
.banner {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #1c2436;
}
.banner-err { border-color: #5b2a2c; background: #2a1a1c; color: #ffc4bf; }
.banner-ok { border-color: #26503f; background: #16281f; color: #a9e6c9; }
.banner-info { border-color: #2a3f63; background: #16203a; color: #b8cdf3; }

/* ---------- kv ---------- */
.kv { display: flex; flex-direction: column; gap: 6px; }
.kv-row { display: flex; gap: 10px; font-size: 13px; }
.kv-k { color: var(--dim); min-width: 96px; }
.kv-v { color: var(--txt); word-break: break-all; }

/* ---------- 检查项 ---------- */
.checks { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.chk .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim2); }
.chk.ok .dot { background: var(--green); }
.chk.bad .dot { background: var(--red); }
.chk code { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--dim2); }

/* ---------- 快捷入口 ---------- */
.quick { display: flex; gap: 10px; flex-wrap: wrap; }
.qbtn {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--txt);
  font-size: 13px;
}
.qbtn:hover { background: #22304a; text-decoration: none; }
.qbtn-danger { border-color: #5b2a2c; color: #ffb4ae; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #202a3d;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
}
.chip-warn { border-color: #5b4a2a; color: #f0d6a0; }
.chip-x { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.chip-x:hover { color: var(--red); }
.preview { font-size: 12.5px; color: var(--dim); margin-bottom: 8px; }
.preview strong { color: var(--txt); }

/* ---------- 状态/空态 ---------- */
.empty { padding: 24px 8px; text-align: center; color: var(--dim2); font-size: 13px; }
.loading { padding: 18px 8px; color: var(--dim); font-size: 13px; }
.spin {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid #33405c;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: sp .8s linear infinite;
  vertical-align: -1px;
}
@keyframes sp { to { transform: rotate(360deg); } }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: #22304a;
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: #b8cdf3;
}

/* ---------- 战报详情 ---------- */
.drawer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.drawer-t { font-size: 15px; font-weight: 650; margin-bottom: 10px; }
.side { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.side-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.res { font-weight: 700; padding: 0 6px; border-radius: 4px; }
.res-1 { color: #8ff0c4; }
.res-0 { color: #ffb4ae; }
.res--1 { color: var(--gold); }
.units { display: flex; flex-direction: column; gap: 8px; }
.unit { background: #141b29; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.unit-h { margin-bottom: 4px; }
.unit-b { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.skill, .gear {
  font-size: 11.5px;
  border-radius: 4px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  background: #1b2334;
  color: #c3d0e8;
}
.gear { color: #e7cf9c; border-color: #4a3f26; background: #241f16; }
.danger-zone { border: 1px dashed #5b2a2c; border-radius: 8px; padding: 12px; margin-top: 8px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(4, 8, 16, .68); }
.modal-box {
  position: relative;
  width: min(720px, calc(100vw - 48px));
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #1d2740;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
  max-width: 520px;
}
.toast[hidden] { display: none; }
.toast-ok { border-color: #26503f; background: #16281f; color: #a9e6c9; }
.toast-err { border-color: #5b2a2c; background: #2a1a1c; color: #ffc4bf; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-title { font-size: 20px; font-weight: 700; text-align: center; margin: 0 0 4px; }
.login-sub { font-size: 12.5px; color: var(--dim); text-align: center; margin: 0 0 22px; }
.login-hint { font-size: 12px; color: var(--dim2); margin-top: 14px; text-align: center; }
.login-err { font-size: 13px; color: #ffb4ae; min-height: 20px; margin: 8px 0 0; }
.ua { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.job-box { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }

/* ================= 移动端 / 平板适配 ================= */

html { -webkit-text-size-adjust: 100%; }

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #182033;
  cursor: pointer;
  flex: 0 0 auto;
}
.menu-ico,
.menu-ico::before,
.menu-ico::after {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--txt);
  border-radius: 2px;
  position: relative;
}
.menu-ico::before,
.menu-ico::after {
  content: '';
  position: absolute;
  left: 0;
}
.menu-ico::before { top: -5px; }
.menu-ico::after { top: 5px; }

.side-mask { display: none; }

/* --- 平板 / 手机：侧栏变抽屉 --- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }

  .menu-btn { display: inline-flex; }

  .side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 252px;
    height: 100%;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 12px 0 40px rgba(0, 0, 0, .45);
    overflow-y: auto;
    padding-top: max(18px, env(safe-area-inset-top));
  }
  .side.open { transform: none; }

  .side-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(4, 8, 16, .62);
  }
  .side-mask[hidden] { display: none; }
  body.side-open { overflow: hidden; }

  .nav-item { padding: 11px 12px; font-size: 14.5px; }

  .top {
    padding: 10px 14px;
    gap: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .page-title { font-size: 16px; flex: 1; min-width: 0; }
  .top-status { font-size: 12px; }

  .view {
    padding: 14px 14px calc(56px + env(safe-area-inset-bottom));
    gap: 12px;
  }

  .stats { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat-v { font-size: 19px; }

  .card { padding: 14px; border-radius: 10px; }
  .card-t { margin-bottom: 10px; }

  /* 表单行：竖排、控件占满宽 */
  .row:not(.row-tight) { flex-direction: column; align-items: stretch; gap: 10px; }
  .row:not(.row-tight) > .btn { width: 100%; }
  .input { width: 100%; min-width: 0; }
  .field { gap: 6px; }

  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }

  .quick { flex-direction: column; }
  .qbtn { text-align: center; }

  .pager { justify-content: space-between; flex-wrap: wrap; }

  .kv-row { flex-direction: column; gap: 2px; }
  .kv-k { min-width: 0; font-size: 12px; }

  .drawer { padding: 14px; }
  .side-head { gap: 6px; }
  .unit-b { gap: 4px; }

  .toast { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: none; }
}

/* --- 手机：表格变卡片、弹窗全屏 --- */
@media (max-width: 700px) {
  .table-wrap { overflow: visible; }
  .table { display: block; }
  .table thead { display: none; }
  .table tbody, .table tr, .table td { display: block; width: auto; }
  .table tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #161d2b;
    padding: 8px 12px;
    margin-bottom: 10px;
  }
  .table tbody tr:hover { background: #161d2b; }
  .table td {
    border: none;
    padding: 4px 0;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
  }
  .table td[data-label]::before {
    content: attr(data-label);
    color: var(--dim);
    font-size: 12px;
    flex: 0 0 84px;
    text-align: left;
  }
  .table td:not([data-label]) { justify-content: flex-end; }
  .table td code { word-break: break-all; text-align: right; }
  .row-tight { justify-content: flex-end; flex-wrap: wrap; }

  .modal { align-items: stretch; }
  .modal-box {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }
  .modal-body { padding: 14px; }
  .modal-head { padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); }
  .modal-foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }

  .pre { max-height: 46vh; }

  .login-box { width: min(380px, 92vw); padding: 22px; }
  .login-wrap { padding: 16px; }
}

/* --- 超窄屏细节 --- */
@media (max-width: 380px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .page-title { font-size: 15px; }
}

.build-tag { font-size: 10.5px; color: var(--dim2); margin-top: 2px; letter-spacing: .3px; }

/* ---------- 登录页图形验证码 ---------- */
.captcha-block { display: block; }
.captcha-block[hidden] { display: none; }
.captcha-row { display: flex; gap: 8px; align-items: center; }
.captcha-row .input { flex: 1; }
.captcha-img {
  height: 42px;
  width: 110px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: #f2f2f2;
  image-rendering: pixelated;
}
.captcha-hint { font-size: 12px; color: var(--dim2); margin-top: 4px; }
.linkbtn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  text-decoration: underline;
}
