/* 永夜幻想 · 运营后台 */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg:        #0e1014;
  --bg2:       #151922;
  --bg3:       #1c212c;
  --line:      #252b38;
  --line2:     #313849;
  --txt:       #d8dde8;
  --txt2:      #8b94a8;
  --txt3:      #5f6879;
  --gold:      #e0b44a;
  --gold-d:    #b8902f;
  --green:     #3ecf8e;
  --red:       #e0556a;
  --blue:      #5b9bd5;
  --purple:    #a78bfa;
}

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

a { color: var(--gold); text-decoration: none; }
a:hover { color: #f5cd6e; }
code { background: var(--bg3); padding: 1px 5px; border-radius: 3px; font-size: 12px; color: var(--gold); }

.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 12.5px; }
.xs { font-size: 11px; }
.dim { color: var(--txt2); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.hl { color: var(--gold); }
.warn { color: var(--gold); }
.err { color: var(--red); }
.link { color: var(--gold); }

/* ---------------- 布局 ---------------- */

.shell { display: flex; min-height: 100vh; }

.side {
  width: 216px; flex: 0 0 216px;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid var(--line);
}
.brand .logo {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-d));
  color: #1a1408; font-weight: 800; font-size: 17px;
  border-radius: 9px;
}
.brand .logo.big { width: 52px; height: 52px; font-size: 26px; border-radius: 14px; }
.brand b { display: block; font-size: 14px; letter-spacing: .5px; }
.brand small { display: block; font-size: 11px; color: var(--txt3); }

.side nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.side nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; margin-bottom: 2px;
  color: var(--txt2); border-radius: 7px;
  font-size: 13.5px; transition: background .12s, color .12s;
}
.side nav a i { font-style: normal; width: 17px; text-align: center; opacity: .85; }
.side nav a:hover { background: var(--bg3); color: var(--txt); }
.side nav a.active { background: rgba(224,180,74,.13); color: var(--gold); font-weight: 600; }

.side-foot { padding: 12px 14px; border-top: 1px solid var(--line); }
.side-foot .who { font-size: 12.5px; margin-bottom: 6px; color: var(--txt2); }
.side-foot .out { font-size: 12px; color: var(--txt3); }
.side-foot .out:hover { color: var(--red); }

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

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 24px; border-bottom: 1px solid var(--line);
  background: var(--bg2); position: sticky; top: 0; z-index: 5;
}
.top h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: .3px; }
.top-right { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--txt3); }
.top-right .zone {
  background: rgba(224,180,74,.12); color: var(--gold);
  padding: 3px 10px; border-radius: 20px; font-size: 12px;
}

.content { padding: 20px 24px 40px; }

/* ---------------- 提示条 ---------------- */

.flash {
  margin: 0 24px; margin-top: 14px;
  padding: 11px 16px; border-radius: 8px;
  font-size: 13.5px; border: 1px solid;
}
.flash-ok  { background: rgba(62,207,142,.09); border-color: rgba(62,207,142,.34); color: #7ee2b4; }
.flash-err { background: rgba(224,85,106,.09); border-color: rgba(224,85,106,.34); color: #f08a9c; }
.flash-info{ background: rgba(91,155,213,.09); border-color: rgba(91,155,213,.34); color: #8dbde8; }

/* ---------------- KPI ---------------- */

.kpis {
  display: grid; gap: 14px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
}
.kpis-sm { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; padding: 15px 17px;
}
.kpi-label { font-size: 12px; color: var(--txt3); margin-bottom: 5px; letter-spacing: .3px; }
.kpi-value { font-size: 25px; font-weight: 700; line-height: 1.2; letter-spacing: -.5px; }
.kpi-value.hl { color: var(--gold); }
.kpi-value.pos { color: var(--green); }
.kpi-value.neg { color: var(--red); }
.kpi-value.warn { color: var(--gold); }
.kpi-sub { font-size: 11.5px; color: var(--txt3); margin-top: 5px; }
.kpi-sub b { color: var(--txt2); font-weight: 600; }

/* ---------------- 卡片 ---------------- */

.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin-bottom: 18px; }
@media (max-width: 1180px) { .grid2 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 18px; overflow: hidden;
}
.card-gen { border-color: rgba(224,180,74,.5); }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 13px 17px; border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head h2 .dim { font-weight: 400; font-size: 12px; margin-left: 6px; }

.sub-head {
  padding: 13px 17px 0; font-size: 13px; font-weight: 600; color: var(--txt2);
}

/* ---------------- 表格 ---------------- */

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 10px 13px; text-align: left; border-bottom: 1px solid var(--line); }
.tbl thead th {
  font-size: 11.5px; font-weight: 600; color: var(--txt3);
  text-transform: uppercase; letter-spacing: .5px;
  background: rgba(255,255,255,.012);
  white-space: nowrap;
}
.tbl tbody tr:hover { background: rgba(255,255,255,.022); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .empty { text-align: center; color: var(--txt3); padding: 34px 14px; font-size: 13px; }
.tbl.kv th { width: 150px; color: var(--txt2); font-weight: 500; font-size: 12.5px; }
.tbl.kv td { font-size: 13px; }

/* ---------------- 标记 ---------------- */

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 4px;
  background: rgba(167,139,250,.13); color: var(--purple);
  font-size: 11px; font-family: Consolas, monospace;
}
.tag-err { background: rgba(224,85,106,.13); color: var(--red); }

.st {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; white-space: nowrap;
  background: var(--bg3); color: var(--txt2);
}
.st-online, .st-complete, .st-charged {
  background: rgba(62,207,142,.13); color: var(--green);
}
.st-offline { background: var(--bg3); color: var(--txt3); }
.st-banned, .st-review { background: rgba(224,85,106,.13); color: var(--red); }
.st-pending, .st-quoted { background: rgba(224,180,74,.13); color: var(--gold); }
.st-delivering { background: rgba(91,155,213,.13); color: var(--blue); }

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 15px; border-radius: 7px;
  border: 1px solid var(--line2); background: var(--bg3);
  color: var(--txt); font-size: 13px; font-family: inherit;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.btn:hover { background: var(--line); border-color: var(--line2); color: #fff; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-d));
  border-color: transparent; color: #1a1408; font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.1); color: #1a1408; }
.btn-danger { border-color: rgba(224,85,106,.4); color: var(--red); }
.btn-danger:hover { background: rgba(224,85,106,.14); color: #ff8ba0; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--txt3); }
.btn-ghost:hover { background: var(--bg3); color: var(--txt); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 5px; }
.btn-block { width: 100%; padding: 10px; font-size: 14px; margin-top: 6px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------- 表单 ---------------- */

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--txt3); margin-bottom: 5px; }
.field.grow { flex: 1; min-width: 190px; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 8px 11px;
  background: var(--bg); border: 1px solid var(--line2);
  border-radius: 7px; color: var(--txt);
  font: inherit; font-size: 13px; outline: none;
  transition: border-color .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold-d); }
textarea { resize: vertical; line-height: 1.6; }
select.sel { width: auto; min-width: 130px; padding: 6px 10px; font-size: 12.5px; }
input.mini {
  width: 120px; padding: 3px 8px; font-size: 12px;
  display: inline-block; vertical-align: middle;
}

.form-inline {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  padding: 15px 17px;
}
.form-inline .field { margin-bottom: 0; }

.row-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }

.search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search input[type=text] { width: 210px; }

.hint {
  margin: 0; padding: 0 17px 15px;
  font-size: 12px; color: var(--txt3); line-height: 1.7;
}
.form-inline + .hint { padding-top: 4px; }

/* ---------------- 分页 ---------------- */

.pager {
  display: flex; gap: 5px; align-items: center; flex-wrap: wrap;
  padding: 13px 17px; border-top: 1px solid var(--line);
}
.pg {
  padding: 5px 11px; border-radius: 6px; font-size: 12.5px;
  background: var(--bg3); color: var(--txt2); border: 1px solid transparent;
}
.pg:hover { background: var(--line); color: var(--txt); }
.pg.cur { background: rgba(224,180,74,.16); color: var(--gold); font-weight: 600; }
.pg-info { margin-left: auto; font-size: 12px; color: var(--txt3); }

/* ---------------- 图表 ---------------- */

.chart {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 20px 17px 12px; min-height: 178px;
  overflow-x: auto;
}
.chart-wide { gap: 3px; min-height: 200px; }
.bar-col {
  flex: 1 0 auto; min-width: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 4px; height: 150px;
}
.chart-wide .bar-col { min-width: 14px; }
.bar {
  width: 100%; max-width: 34px;
  background: linear-gradient(180deg, var(--gold), var(--gold-d));
  border-radius: 3px 3px 0 0;
  min-height: 2px; transition: filter .12s;
}
.chart-wide .bar { max-width: 18px; }
.bar-v { background: linear-gradient(180deg, #7c9ef0, #4a6bc4); }
.bar-d { background: linear-gradient(180deg, #46c9a8, #2d8f78); }
.bar-col:hover .bar { filter: brightness(1.25); }
.bar-val { font-size: 10px; color: var(--txt3); height: 13px; }
.bar-x {
  font-size: 10px; color: var(--txt3);
  white-space: nowrap; transform: rotate(-55deg);
  transform-origin: center; height: 22px;
}
.chart:not(.chart-wide) .bar-x { transform: none; font-size: 10.5px; }

.pbar {
  height: 7px; background: var(--bg3); border-radius: 4px; overflow: hidden;
  min-width: 90px;
}
.pbar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--gold-d), var(--gold));
  border-radius: 4px;
}

/* ---------------- 标签页 ---------------- */

.tabs {
  display: flex; gap: 3px; padding: 0 17px;
  border-bottom: 1px solid var(--line);
}
.tab {
  padding: 10px 15px; font-size: 13px; color: var(--txt3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--txt); }
.tab.cur { color: var(--gold); border-bottom-color: var(--gold); font-weight: 600; }

/* ---------------- 资产面板 ---------------- */

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 1px;
  background: var(--line);
}
.asset { background: var(--bg2); padding: 12px 16px; }
.asset span { display: block; font-size: 11.5px; color: var(--txt3); margin-bottom: 4px; }
.asset b { font-size: 16px; font-weight: 600; letter-spacing: -.2px; }

.quick-row {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  padding: 0 17px 15px;
}

/* ---------------- 角色信息网格 ---------------- */

.info-grid {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  background: var(--line);
}
.info-grid > div {
  background: var(--bg2); padding: 12px 17px;
}
.info-grid span { display: block; font-size: 11.5px; color: var(--txt3); margin-bottom: 3px; }
.info-grid b { font-size: 13.5px; font-weight: 600; }

/* ---------------- CDK 生成结果 ---------------- */

.gen-box {
  margin: 0; padding: 15px 17px;
  background: var(--bg); border-bottom: 1px solid var(--line);
  font-family: Consolas, monospace; font-size: 12.5px;
  color: var(--green); line-height: 1.9;
  max-height: 300px; overflow: auto; white-space: pre;
}
.card-gen .btn-primary { margin: 14px 17px 16px; }

/* ---------------- 登录 ---------------- */

.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(900px 480px at 50% -12%, rgba(224,180,74,.10), transparent 62%),
    var(--bg);
}
.login-wrap { width: 100%; max-width: 384px; padding: 24px; }
.login-card {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 14px; padding: 32px 28px 24px;
  box-shadow: 0 22px 60px rgba(0,0,0,.5);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .logo { margin: 0 auto 13px; }
.login-brand h2 { margin: 0 0 3px; font-size: 19px; font-weight: 700; letter-spacing: 1.5px; }
.login-brand p { margin: 0; font-size: 12px; color: var(--txt3); letter-spacing: 2px; }
.login-card .field { margin-bottom: 15px; }
.login-card .field > span { font-size: 12px; }
.login-card input { padding: 10px 12px; font-size: 13.5px; }
.login-foot {
  display: flex; justify-content: space-between;
  margin-top: 20px; padding-top: 15px;
  border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--txt3);
}
.login-tip {
  text-align: center; margin: 18px 0 0;
  font-size: 11.5px; color: var(--txt3); line-height: 1.7;
}
.login-card .flash { margin: 0 0 16px; }

/* ---------------- 滚动条 ---------------- */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3d4558; }

@media (max-width: 860px) {
  .side { width: 60px; flex: 0 0 60px; }
  .side .brand div, .side nav a span, .side nav a { font-size: 0; }
  .side nav a i { font-size: 15px; }
  .side-foot .who, .side-foot .out { display: none; }
  .content { padding: 14px; }
  .top { padding: 12px 14px; }
}
