/* 星耀 · NX 二次开发知识库 —— 管理后台样式 */
:root {
  --ink: #1f2937;
  --muted: #6b7280;
  --paper: #ffffff;
  --canvas: #f4f6f9;
  --line: #e6eaf2;
  --accent: #2563eb;
  --accent-deep: #1d4ed8;
  --soft: #e8f0fe;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  font-family: "Microsoft YaHei UI", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
}

.hidden { display: none !important; }

h1, h2 { margin: 0; font-weight: 600; }
h2 { font-size: 19px; margin-bottom: 16px; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 8px 16px;
  transition: background .15s, color .15s, border-color .15s;
}

button:disabled { opacity: .55; cursor: not-allowed; }

.primary { background: var(--accent); color: #fff; }
.primary:not(:disabled):hover { background: var(--accent-deep); }

.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.ghost:not(:disabled):hover { background: var(--soft); color: var(--accent-deep); border-color: #c7dbff; }
a.ghost { text-decoration: none; display: inline-flex; align-items: center; }

.danger { background: #fff; border-color: #f2c6c6; color: var(--danger); }
.danger:hover { background: #fdf0f0; }

.block { width: 100%; padding: 11px; font-size: 15px; }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
label input, label select, label textarea { margin-top: 6px; color: var(--ink); font-size: 14px; }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--ink); }
label.inline input { width: auto; }

.hint { color: var(--muted); font-size: 12.5px; line-height: 1.8; }
.msg { min-height: 20px; font-size: 13px; margin: 8px 0 0; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef3fd, #f7f9fc 55%, #eaf1ff);
}

.auth-card {
  width: 400px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 14px 40px rgba(31, 41, 55, .08);
}

.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-row.compact { gap: 9px; }
.brand-row h1 { font-size: 17px; }
.brand-row p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.brand-row strong { font-size: 14.5px; }

.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4b8df8, #1d4ed8);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(29, 78, 216, .28);
}

.mark.small { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; }

.tabs {
  display: flex;
  gap: 4px;
  margin: 24px 0 18px;
  padding: 3px;
  background: #f3f5f9;
  border-radius: 10px;
}

.tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
  padding: 8px;
  border-radius: 7px;
}

.tab.active { background: #fff; color: var(--accent-deep); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

/* ---------- 主界面 ---------- */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
}

.topbar-right { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 13px; }

.layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: calc(100vh - 60px); }

.side {
  padding: 18px 12px;
  background: #fbfcfe;
  border-right: 1px solid var(--line);
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: #4b5563;
  padding: 9px 12px;
  margin-bottom: 4px;
}

.nav-item:hover { background: #f1f4f9; }
.nav-item.active { background: var(--soft); color: var(--accent-deep); font-weight: 600; }

.content { padding: 24px clamp(18px, 3vw, 40px) 40px; min-width: 0; }
.page { max-width: 1180px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}

.stat strong { display: block; font-size: 26px; margin-bottom: 4px; }
.stat span { color: var(--muted); font-size: 12.5px; }
.stat.alert strong { color: var(--warn); }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; min-width: 180px; max-width: 340px; }
.toolbar select { width: auto; min-width: 120px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
}

.grid2 { display: grid; grid-template-columns: minmax(0,1fr) 130px minmax(0,1fr) minmax(0,1fr); gap: 14px; }
.grid-ver { display: grid; grid-template-columns: 160px minmax(0,1fr); gap: 14px; }

.actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #fafbfd; color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
td.nowrap { white-space: nowrap; }
td.ops { white-space: nowrap; }
td.ops button { padding: 5px 11px; font-size: 12.5px; margin-right: 6px; }
td.ops a.ghost { padding: 5px 11px; font-size: 12.5px; margin-right: 6px; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2f7;
  color: #475569;
}

.tag.ok { background: #e7f7ed; color: var(--ok); }
.tag.warn { background: #fdf3e3; color: var(--warn); }
.tag.off { background: #f4f4f5; color: #71717a; }
.tag.admin { background: var(--soft); color: var(--accent-deep); }

.empty { padding: 30px; text-align: center; color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 60;
  transform: translateX(-50%) translateY(10px);
  background: #111827;
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  max-width: 80vw;
}

.toast.show { opacity: .95; transform: translateX(-50%) translateY(0); }
.toast.err { background: #991b1b; }

/* ---------- 弹层（与 exe 原生窗口的 Overlay 卡片对齐） ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 24, 39, .35);
}

.modal {
  width: 400px;
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 18px 48px rgba(17, 24, 39, .18);
}

.modal.confirm { width: 420px; }
.modal.reset { width: 440px; }

.modal label:last-of-type { margin-bottom: 0; }
.modal .hint { margin: 0 0 10px; }
.modal .actions { margin-top: 14px; }
.modal input[readonly] { font-size: 15px; font-weight: 600; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: flex; gap: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-item { width: auto; white-space: nowrap; }
  .grid2 { grid-template-columns: 1fr; }
  .grid-ver { grid-template-columns: 1fr; }
}
