/* 星辰奇缘 · 后台管理系统 */
:root {
  --bg: #0e131d;
  --panel: #161e2b;
  --panel2: #1b2434;
  --line: #27324a;
  --txt: #dbe4f3;
  --muted: #8b9bb4;
  --accent: #4c8dff;
  --ok: #35c48a;
  --bad: #ff6b6b;
  --warn: #f5a623;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.65 system-ui, -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
code { font-family: ui-monospace, Consolas, monospace; }

/* ===== 布局 ===== */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 208px;
  flex: 0 0 208px;
  background: linear-gradient(180deg, #141c29, #0f1520);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { font-size: 17px; font-weight: 700; letter-spacing: .4px; margin-bottom: 26px; }
.brand em { display: block; font-style: normal; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  color: var(--txt);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  transition: background .15s;
}
.nav a:hover { background: #1b2537; }
.nav a.on {
  background: linear-gradient(90deg, #2f5fd0, #3f7bff);
  color: #fff;
  box-shadow: 0 2px 12px rgba(63, 123, 255, .35);
}

.side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.side-foot a { color: var(--muted); }
.side-foot a:hover { color: var(--txt); }

.main { flex: 1; min-width: 0; padding: 22px 28px 60px; }

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.top h1 { font-size: 20px; margin: 0; }
.who { font-size: 13px; color: var(--muted); }

/* ===== 卡片 ===== */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.muted { color: var(--muted); font-weight: 400; font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* ===== 表单 ===== */
input[type=text], input[type=password], input[type=number], input[type=date], select {
  background: #0d1420;
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 141, 255, .18); }
input::placeholder { color: #5f6d84; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label input, label select { color: var(--txt); }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form input { width: 240px; }

.search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search input { width: 220px; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.check-line { flex-direction: row; align-items: center; gap: 8px; color: var(--txt); font-size: 13px; }

.field { margin-bottom: 16px; }
.field > label { margin-bottom: 8px; }
.field > input[type=text] { width: 320px; }

.row-ops { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.check-list { display: flex; flex-wrap: wrap; gap: 10px 18px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #1e2839;
  color: var(--txt);
  font: inherit;
  cursor: pointer;
  transition: filter .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: linear-gradient(135deg, #2f6ae0, #4c8dff); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }

.mini {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #1e2839;
  color: var(--txt);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.mini:hover { filter: brightness(1.2); }
.mini.primary { background: #2f6ae0; border-color: transparent; color: #fff; }
.mini.ghost { background: transparent; }
.mini.danger { background: #3a1f26; border-color: #5c2b33; color: #ffb3b3; }

/* ===== 表格 ===== */
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.grid td { padding: 10px; border-bottom: 1px solid #1e2739; vertical-align: middle; }
.grid tbody tr:hover { background: #182130; }
.grid .empty { text-align: center; color: var(--muted); padding: 26px; }
.grid .preview { color: #a9b8cd; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid .ops { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.grid .ops form { display: inline-flex; margin: 0; }

.code { background: #0b1220; border: 1px solid var(--line); padding: 2px 7px; border-radius: 5px; color: #8fd3ff; font-size: 12px; }

/* ===== 标签 ===== */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: #232b3c;
  color: var(--muted);
}
.tag.ok { background: rgba(53, 196, 138, .14); color: var(--ok); }
.tag.bad { background: rgba(255, 107, 107, .14); color: var(--bad); }

/* 区服 / 角色标签 */
.roles { display: flex; flex-direction: column; gap: 5px; }
.ztag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 6px;
  background: #1c2637;
  border: 1px solid #263349;
  font-size: 12px;
}
.ztag em { font-style: normal; color: var(--accent); font-size: 11px; }
.ztag .lv, .ztag .rid { color: var(--muted); font-size: 11px; }
.ztag .rid { color: #5f6d84; }
.ztag.bad { border-color: #5c2b33; background: #3a1f26; color: #ffb3b3; }
.zone-select { min-width: 260px; }
.dlg select { width: 100%; }

/* ===== 提示条 ===== */
.flash {
  padding: 10px 14px;
  border-radius: 9px;
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid transparent;
  white-space: pre-wrap;
}
.flash.ok { background: rgba(53, 196, 138, .1); border-color: rgba(53, 196, 138, .35); color: #86e5bb; }
.flash.err { background: rgba(255, 107, 107, .1); border-color: rgba(255, 107, 107, .35); color: #ffb3b3; }

/* ===== 物品行 ===== */
.rows { display: flex; flex-direction: column; gap: 8px; }
.irow { display: flex; align-items: center; gap: 10px; }
.irow .in-code { width: 140px; }
.irow .in-qty { width: 90px; }
.irow .in-name { flex: 1; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.irow .in-name.bad { color: var(--bad); }

/* ===== 分页 ===== */
.pager { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pager a {
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--txt);
  font-size: 13px;
}
.pager a.on { background: #2f6ae0; border-color: transparent; color: #fff; }

/* ===== 弹窗 ===== */
.dlg {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel2);
  color: var(--txt);
  padding: 0;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.dlg::backdrop { background: rgba(4, 8, 14, .66); }
.dlg form { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.dlg h3 { margin: 0; font-size: 16px; }
.dlg p { margin: 0; font-size: 13px; }
.dlg label { font-size: 13px; }
.dlg input[type=text] { width: 100%; }
.dlg-ops { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ===== 登录 / 初始化 ===== */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 480px at 18% 8%, rgba(63, 123, 255, .18), transparent 60%),
    radial-gradient(700px 420px at 86% 92%, rgba(53, 196, 138, .12), transparent 60%),
    #0b1018;
  padding: 24px;
}
.auth-card {
  width: 380px;
  background: rgba(22, 30, 43, .92);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 28px 26px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .5);
  backdrop-filter: blur(6px);
}
.auth-card h1 { font-size: 20px; margin: 0 0 6px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card label { font-size: 13px; }
.auth-card input { width: 100%; padding: 10px 12px; }
.auth-card .btn { margin-top: 6px; }

/* ===== 公告发布 ===== */
textarea {
  background: #0d1420;
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  min-height: 160px;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 141, 255, .18); }
.radio-row { display: flex; align-items: center; gap: 18px; margin: 14px 0 4px; flex-wrap: wrap; }
.radio-row > .muted { font-size: 13px; }
label.radio { flex-direction: row; align-items: center; gap: 6px; color: var(--txt); font-size: 13px; }
label.radio input { accent-color: var(--accent); }

/* ===== 小屏兜底（PC 优先） ===== */
@media (max-width: 1080px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
