/* ==========================================================================
 * 月灵永恒传奇 V6.70 · 运营后台样式
 * 深色、紧凑、高信息密度（运维后台取向，不做 C 端观感）
 * 零外部依赖：系统字体栈 + Unicode 符号
 * ========================================================================== */

:root {
  --bg:        #0e1116;
  --bg-2:      #131820;
  --panel:     #161c25;
  --panel-2:   #1b222c;
  --panel-3:   #212a35;
  --border:    #2a3441;
  --border-2:  #35414f;
  --text:      #d6dde6;
  --text-2:    #9aa7b6;
  --text-3:    #6f7d8d;
  --accent:    #3d8bfd;
  --accent-dim:#1e3d63;
  --ok:        #2ecc71;
  --warn:      #f0a020;
  --danger:    #ef4b4b;
  --info:      #38bdf8;
  --purple:    #a78bfa;
  --radius:    6px;
  --sidebar-w: 196px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  --sans: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", -apple-system,
          BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger); }
.right { text-align: right; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
code { font-family: var(--mono); background: var(--panel-3); padding: 1px 4px; border-radius: 3px; font-size: 12px; }

/* ------------------------------ 登录页 ------------------------------ */
.login-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% 0%, #182233 0%, var(--bg) 70%);
}
.login-card {
  width: 340px; padding: 28px 26px 20px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.login-logo {
  width: 42px; height: 42px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, #2b6fd0, #1b3f70);
  color: #fff; font-size: 22px; font-weight: 700; border-radius: 10px;
}
.login-title { margin: 0; text-align: center; font-size: 19px; letter-spacing: 2px; }
.login-sub { margin: 4px 0 20px; text-align: center; color: var(--text-3); font-size: 12px; letter-spacing: 1px; }
.login-hint { margin: 14px 0 0; text-align: center; color: var(--text-3); font-size: 11px; line-height: 1.6; }
.login-error { margin: 10px 0 0; min-height: 16px; text-align: center; color: var(--danger); font-size: 12px; }

/* ------------------------------ 布局 ------------------------------ */
.app { display: flex; height: 100vh; width: 100%; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 30;
}
.sidebar-head {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 12px; border-bottom: 1px solid var(--border);
}
.sidebar-head .logo {
  width: 28px; height: 28px; flex: 0 0 28px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, #2b6fd0, #1b3f70);
  color: #fff; border-radius: 7px; font-weight: 700;
}
.brand { font-size: 13px; font-weight: 600; letter-spacing: .5px; }
.brand-sub { font-size: 10px; color: var(--text-3); letter-spacing: .5px; }

.nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px; cursor: pointer; color: var(--text-2);
  border-left: 2px solid transparent; font-size: 13px; user-select: none;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: #fff; border-left-color: var(--accent); }
.nav-item .nav-icon { width: 16px; text-align: center; opacity: .85; }
.nav-item .nav-badge {
  margin-left: auto; font-size: 10px; padding: 0 5px; border-radius: 8px;
  background: var(--warn); color: #1a1a1a; font-weight: 700;
}
.sidebar-foot {
  padding: 8px 12px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 6px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--danger); }

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

.topbar {
  height: 44px; flex: 0 0 44px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.page-title { font-size: 14px; font-weight: 600; letter-spacing: .5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.zone-picker { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.zone-picker select { min-width: 130px; }
.admin-name { font-size: 12px; color: var(--text-2); }

.view { flex: 1; overflow: auto; padding: 14px; }

/* 窄屏：侧边栏抽屉化 */
.only-narrow { display: none; }
@media (max-width: 900px) {
  .only-narrow { display: inline-flex; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    transform: translateX(-100%); transition: transform .18s ease;
    box-shadow: 6px 0 24px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 25; }
  .zone-picker span { display: none; }
  .admin-name { display: none; }
  .view { padding: 10px; }
}

/* ------------------------------ 卡片 / 栅格 ------------------------------ */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.card-title { margin: 0; font-size: 13px; font-weight: 600; }
.card-extra { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-body { padding: 12px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
@media (max-width: 1200px) { .grid-5, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px)  { .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; } }

.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; min-width: 0;
}
.stat-label { font-size: 11px; color: var(--text-3); letter-spacing: .5px; }
.stat-value { font-size: 19px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat-value.sm { font-size: 14px; }
.stat-sub { font-size: 11px; color: var(--text-2); margin-top: 3px; }

/* ------------------------------ 徽章 / 提示条 ------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: 9px; font-size: 11px; line-height: 17px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.ok      { background: rgba(46,204,113,.14); color: #57d98f; border-color: rgba(46,204,113,.35); }
.badge.warn    { background: rgba(240,160,32,.14); color: #f3b44a; border-color: rgba(240,160,32,.4); }
.badge.danger  { background: rgba(239,75,75,.14);  color: #f47272; border-color: rgba(239,75,75,.4); }
.badge.info    { background: rgba(61,139,253,.14); color: #74a9fb; border-color: rgba(61,139,253,.4); }
.badge.info2   { background: rgba(56,189,248,.14); color: #5cc9f5; border-color: rgba(56,189,248,.4); }
.badge.purple  { background: rgba(167,139,250,.14); color: #b9a3fb; border-color: rgba(167,139,250,.4); }
.badge.muted   { background: rgba(154,167,182,.12); color: var(--text-2); border-color: var(--border-2); }
.badge.solid-warn { background: var(--warn); color: #171717; font-weight: 700; }

.banner {
  border-radius: var(--radius); padding: 9px 12px; margin-bottom: 12px;
  border: 1px solid var(--border-2); background: var(--panel-2); font-size: 12.5px;
}
.banner .b-title { font-weight: 600; margin-bottom: 3px; display: block; }
.banner.info   { border-color: rgba(61,139,253,.45); background: rgba(61,139,253,.08); }
.banner.ok     { border-color: rgba(46,204,113,.45); background: rgba(46,204,113,.08); }
.banner.warn   { border-color: rgba(240,160,32,.5);  background: rgba(240,160,32,.1); }
.banner.danger { border-color: rgba(239,75,75,.5);   background: rgba(239,75,75,.1); }
.banner ul { margin: 4px 0 0; padding-left: 18px; }
.banner li { margin: 2px 0; }

/* needs_attention 专用高亮：进程在跑但端口没听，必须人工点窗口按钮 */
.attention {
  border: 1px solid rgba(240,160,32,.65); background: rgba(240,160,32,.12);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px;
}
.attention .a-title { color: #f3b44a; font-weight: 700; margin-bottom: 4px; }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; font-size: 12.5px; font-family: inherit;
  background: var(--panel-3); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius);
  cursor: pointer; white-space: nowrap; line-height: 1.5;
}
.btn:hover:not(:disabled) { background: #2a3543; border-color: #43505f; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: #2f74d0; color: #fff; }
.btn.primary:hover:not(:disabled) { background: #4f97ff; }
.btn.danger  { background: #b53434; border-color: #cf4444; color: #fff; }
.btn.danger:hover:not(:disabled) { background: #c94040; }
.btn.warn    { background: #a3701a; border-color: #c08420; color: #fff; }
.btn.warn:hover:not(:disabled) { background: #b87f1e; }
.btn.ok      { background: #1f7a45; border-color: #279452; color: #fff; }
.btn.ok:hover:not(:disabled) { background: #248a4e; }
.btn.ghost   { background: transparent; border-color: var(--border-2); color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--panel-3); color: var(--text); }
.btn.sm      { padding: 3px 8px; font-size: 11.5px; }
.btn.block   { width: 100%; justify-content: center; padding: 8px; font-size: 13px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ------------------------------ 表单 ------------------------------ */
.field { margin-bottom: 10px; }
.field > label { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 4px; }
.field-hint { margin: 4px 0 0; font-size: 11px; color: var(--text-3); }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=search], select, textarea {
  width: 100%; padding: 5px 8px; font-size: 12.5px; font-family: inherit;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(61,139,253,.18); }
input:disabled, select:disabled, textarea:disabled { opacity: .55; }
textarea { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
select { cursor: pointer; }
input[type=checkbox] { width: auto; margin: 0 5px 0 0; vertical-align: -1px; cursor: pointer; }

.form-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 760px) { .form-grid .span-2 { grid-column: auto; } }
.checkline { display: flex; align-items: flex-start; gap: 2px; font-size: 12.5px; cursor: pointer; margin: 6px 0; }
.checkline input { margin-top: 3px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .spacer { margin-left: auto; }
.filter-bar {
  display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
}
.filter-bar .fb-actions { display: flex; gap: 6px; }

/* ------------------------------ 表格 ------------------------------ */
.table-wrap { overflow: auto; max-width: 100%; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th {
  position: sticky; top: 0; z-index: 1;
  background: var(--panel-2); color: var(--text-2); font-weight: 600; text-align: left;
  padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 11.5px;
}
table.tbl td { padding: 6px 10px; border-bottom: 1px solid rgba(42,52,65,.6); vertical-align: middle; }
table.tbl tbody tr:hover { background: rgba(61,139,253,.06); }
table.tbl tr.danger-row { background: rgba(239,75,75,.07); }
/* needs_attention（进程在跑但端口没听）与「人工步骤」行的高亮 */
table.tbl tr.attention-row { background: rgba(240,160,32,.09); }
table.tbl tr.attention-row:hover { background: rgba(240,160,32,.14); }
table.tbl td.attention-cell { color: #f3b44a; }
table.tbl td.actions { white-space: nowrap; }
table.tbl td.actions .btn { margin-right: 4px; }
table.tbl.compact td, table.tbl.compact th { padding: 4px 8px; }
.tbl-num { text-align: right; font-variant-numeric: tabular-nums; }

.empty { padding: 26px 12px; text-align: center; color: var(--text-3); font-size: 12.5px; }
.empty-icon { font-size: 22px; opacity: .5; margin-bottom: 6px; }
.loading { padding: 30px; text-align: center; color: var(--text-3); }
.err-box {
  padding: 14px; border: 1px solid rgba(239,75,75,.45); background: rgba(239,75,75,.08);
  border-radius: var(--radius); color: #f0a0a0; font-size: 12.5px;
}
.err-box strong { display: block; margin-bottom: 4px; color: #f47272; }

/* ------------------------------ 分页 ------------------------------ */
.pager { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager .page-info { font-size: 11.5px; color: var(--text-2); margin-right: auto; }

/* ------------------------------ 键值 / 进度条 ------------------------------ */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12.5px; }
.kv dt { color: var(--text-3); white-space: nowrap; }
.kv dd { margin: 0; word-break: break-all; }

.progress { height: 7px; background: var(--panel-3); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.progress > i { display: block; height: 100%; background: var(--accent); }
.progress > i.warn { background: var(--warn); }
.progress > i.danger { background: var(--danger); }

/* ------------------------------ 标签页 ------------------------------ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  padding: 7px 14px; font-size: 12.5px; color: var(--text-2); cursor: pointer;
  border-bottom: 2px solid transparent; user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-bottom-color: var(--accent); background: rgba(61,139,253,.07); }
.tab .tab-count { font-size: 11px; color: var(--text-3); margin-left: 5px; }

/* ------------------------------ 区服卡片 ------------------------------ */
.zone-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.zone-card.attention-border { border-color: rgba(240,160,32,.6); }
.zone-card .zc-head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.zone-card .zc-name { font-weight: 600; font-size: 13px; }
.zone-card .zc-id { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.zone-card .zc-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 5px 10px; font-size: 12px; }
.zone-card .zc-grid .k { color: var(--text-3); font-size: 11px; }

/* ------------------------------ 日志查看器 ------------------------------ */
.log-view {
  background: #0a0d11; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 11px; max-height: 460px; overflow: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.65; white-space: pre-wrap;
  word-break: break-all; color: #b9c4d0;
}
.log-view .ln { color: var(--text-3); user-select: none; margin-right: 8px; }
.tree-list { max-height: 380px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.tree-item {
  display: flex; align-items: center; gap: 7px; padding: 5px 10px;
  border-bottom: 1px solid rgba(42,52,65,.5); cursor: pointer; font-size: 12.5px;
}
.tree-item:hover { background: rgba(61,139,253,.08); }
.tree-item.active { background: var(--accent-dim); }
.tree-item .ti-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item .ti-meta { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.crumb { display: flex; align-items: center; gap: 5px; font-size: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.crumb a { color: var(--accent); cursor: pointer; text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

/* ------------------------------ Toast ------------------------------ */
.toast-box {
  position: fixed; top: 12px; right: 12px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 9px 12px; border-radius: var(--radius); cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border-2);
  box-shadow: 0 8px 24px rgba(0,0,0,.45); font-size: 12.5px;
  animation: toast-in .16s ease; word-break: break-word;
}
.toast.out { opacity: 0; transform: translateX(12px); transition: all .22s ease; }
.toast-icon { flex: 0 0 auto; font-weight: 700; }
.toast.ok    { border-color: rgba(46,204,113,.5); background: rgba(23,48,34,.96); }
.toast.ok .toast-icon { color: var(--ok); }
.toast.error { border-color: rgba(239,75,75,.55); background: rgba(54,25,25,.96); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warn  { border-color: rgba(240,160,32,.55); background: rgba(52,39,16,.96); }
.toast.warn .toast-icon { color: var(--warn); }
.toast.info .toast-icon { color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ------------------------------ 模态框 ------------------------------ */
.modal-root { position: fixed; inset: 0; z-index: 90; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.62); }
.modal {
  position: relative; margin: 6vh auto 0; width: calc(100% - 32px);
  max-height: 88vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border-2);
  border-radius: 8px; box-shadow: 0 24px 60px rgba(0,0,0,.6);
  animation: modal-in .14s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--panel-2);
  border-radius: 8px 8px 0 0;
}
.modal-title { font-size: 13.5px; font-weight: 600; flex: 1; }
.modal-body { padding: 14px; overflow: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--border); background: var(--panel-2);
  border-radius: 0 0 8px 8px;
}
.confirm-msg { margin: 0 0 8px; font-size: 13px; }
.confirm-detail {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 11px; font-size: 12px; color: var(--text-2); margin-bottom: 10px;
}
.confirm-detail ul { margin: 4px 0 0; padding-left: 18px; }
.danger-note { color: #f47272; }

/* ------------------------------ 细节 ------------------------------ */
.detail-list { margin: 0; padding-left: 18px; font-size: 12.5px; }
.detail-list li { margin: 3px 0; }
.list-inline { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-key {
  font-family: var(--mono); font-size: 11.5px; background: var(--bg);
  border: 1px solid var(--border-2); border-radius: 4px; padding: 1px 6px;
}
details.spoiler { margin-top: 6px; }
details.spoiler > summary { cursor: pointer; font-size: 12px; color: var(--accent); }
.sec-title { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 12px 0 6px; }
.hr { height: 1px; background: var(--border); margin: 12px 0; border: 0; }
.cell-lines { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-ok { color: var(--ok); }
