/* ============ 管理后台 · 浅色专业风（覆盖 base.css 的暗色体系） ============ */

/* --- 变量覆写：让内联样式的 var() 也走浅色 --- */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e5e8ee;
  --border-strong: #d0d5dd;
  --text: #1b2430;
  --muted: #67717f;
  --dim: #98a2b3;
  --accent: #2456d6;
}

/* --- 全局基调覆写 --- */
body {
  background: #f6f7f9;
  color: #1b2430;
}
body::before { display: none; }
.logo-mark { background: #2456d6; box-shadow: none; color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd4dd; border-radius: 6px; border: 2px solid #f6f7f9; }
::-webkit-scrollbar-thumb:hover { background: #b8bfc9; }

/* --- 通用组件覆写（覆盖 base.css） --- */
.card {
  background: #fff;
  border: 1px solid #e5e8ee;
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card.hover:hover { border-color: #d3d9e2; transform: none; box-shadow: 0 2px 6px rgba(16,24,40,0.07); }

.btn {
  background: #2456d6; color: #fff; border: 1px solid #2456d6;
  box-shadow: none; border-radius: 7px; padding: 8px 16px;
  font-size: 13.5px; font-weight: 600; gap: 6px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: #1d49bd; border-color: #1d49bd; transform: none; box-shadow: none; }
.btn:active { background: #1a41aa; }
.btn.ghost { background: #fff; color: #3d4756; border-color: #d0d5dd; }
.btn.ghost:hover { background: #f4f6f9; border-color: #b9c1cd; color: #1b2430; }
.btn.danger { background: #c53030; border-color: #c53030; color: #fff; }
.btn.danger:hover { background: #ad2727; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 6px; }
.btn.xs { padding: 3px 9px; font-size: 12px; border-radius: 5px; }

.input, select.input, textarea.input {
  background: #fff; border: 1px solid #d5dae2; color: #1b2430;
  border-radius: 7px; padding: 8px 12px; font-size: 13.5px;
  box-shadow: 0 1px 1px rgba(16,24,40,0.03);
}
.input:focus { border-color: #2456d6; box-shadow: 0 0 0 3px rgba(36,86,214,0.13); }
.input::placeholder { color: #9aa4b2; }
select.input option { background: #fff; color: #1b2430; }
.field label { color: #55606f; font-size: 12px; font-weight: 600; }

.badge { border-radius: 5px; font-size: 11.5px; padding: 2px 8px; font-weight: 600; }
.badge.green { color: #087443; background: #e8f6ef; border-color: #bfe4d2; }
.badge.red   { color: #b42318; background: #fdeeec; border-color: #f2c6c0; }
.badge.amber { color: #96510a; background: #fdf4e2; border-color: #f0d9a8; }
.badge.gray  { color: #5a6472; background: #f1f3f6; border-color: #dfe3e9; }
.badge.blue  { color: #1c4fb8; background: #e9effc; border-color: #c4d4f4; }

/* 模态框 */
.modal-mask { background: rgba(23, 29, 38, 0.4); backdrop-filter: none; -webkit-backdrop-filter: none; }
.modal {
  background: #fff; border: 1px solid #e0e4ea; border-radius: 10px;
  box-shadow: 0 16px 48px rgba(16, 24, 40, 0.18); color: #1b2430;
}
.modal h3 { color: #141b26; font-size: 15.5px; }
.modal .modal-foot { margin-top: 18px; }

/* Toast */
.toast {
  background: #fff; border: 1px solid #e0e4ea; border-left: 3px solid #98a2b3;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12); color: #1b2430; border-radius: 7px;
  font-size: 13px; padding: 11px 14px;
}
.toast.ok .t-ico { color: #087443; }
.toast.err { border-left-color: #c53030; }
.toast.err .t-ico { color: #c53030; }
.toast.info { border-left-color: #2456d6; }
.toast.info .t-ico { color: #2456d6; }

/* 表格 */
.tbl-wrap { border: 1px solid #e5e8ee; border-radius: 8px; background: #fff; overflow-x: auto; }
table.tbl { min-width: 640px; font-size: 12.8px; color: #263041; }
.tbl th {
  background: #f8f9fb; color: #67717f; font-size: 11.5px; text-transform: none;
  border-bottom: 1px solid #e5e8ee; padding: 9px 13px; font-weight: 600;
}
.tbl td { border-bottom: 1px solid #f0f2f5; padding: 9px 13px; color: #263041; }
.tbl tbody tr:hover { background: #f7f9fc; }

.pager { color: #67717f; font-size: 12.5px; }
.pager button { background: #fff; border: 1px solid #d5dae2; color: #3d4756; border-radius: 6px; }
.pager button:hover:not(:disabled) { background: #f4f6f9; border-color: #b9c1cd; }

.muted { color: #67717f; }
.dim { color: #98a2b3; }
.mono, .card-key { font-family: ui-monospace, "SF Mono", Consolas, "Courier New", monospace; }

.spin { border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; }
.spin.light { border-color: rgba(36,86,214,0.25); border-top-color: #2456d6; }

/* ============ 页面结构 ============ */
.adm-root.on { display: flex; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 22px; }
.login-card {
  width: 100%; max-width: 380px; padding: 34px 32px 30px;
  animation: fadeUp 0.5s var(--ease) both;
}
.login-card .logo { margin-bottom: 22px; }
.login-card h2 { font-size: 18px; margin-bottom: 4px; color: #141b26; }
.login-card .sub { color: #7b8593; font-size: 12.5px; margin-bottom: 24px; }
.login-card .btn { width: 100%; margin-top: 8px; padding: 10px; }
.login-err {
  display: none; margin-bottom: 14px; padding: 9px 12px; border-radius: 6px; font-size: 12.5px;
  background: #fdeeec; border: 1px solid #f2c6c0; color: #b42318;
}
.login-err.show { display: block; animation: shake 0.4s; }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* 侧栏（深色墨底，扁平） */
.side {
  width: 208px; min-width: 208px; height: 100vh; position: sticky; top: 0;
  background: #131a26; border-right: none;
  display: flex; flex-direction: column; padding: 16px 10px;
}
.side .logo { padding: 6px 10px 16px; border-bottom: 1px solid #232c3d; margin-bottom: 12px; color: #f0f3f8; }
.side .logo .logo-mark {
  background: #2456d6; box-shadow: none; width: 26px; height: 26px;
  border-radius: 6px; font-size: 12.5px; color: #fff;
}
.side .logo .logo-text { font-size: 14.5px; letter-spacing: 0.3px; }
.side-menu { flex: 1; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.menu-item {
  display: flex; align-items: center; gap: 10px; padding: 8.5px 12px; border-radius: 6px;
  color: #9aa6b9; font-size: 13.2px; font-weight: 500; cursor: pointer;
  border: none; background: none; text-align: left; font-family: inherit;
  transition: background 0.12s, color 0.12s; position: relative; width: 100%;
}
.menu-item .m-ico { width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; flex: none; }
.menu-item .m-ico svg { width: 15px; height: 15px; stroke: currentColor; }
.menu-item:hover { color: #e6ebf3; background: #1b2434; }
.menu-item.on { color: #fff; background: #1e2939; }
.menu-item.on::before {
  content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px;
  border-radius: 2px; background: #4c7cf3;
}
.side-foot { border-top: 1px solid #232c3d; padding-top: 10px; display: flex; flex-direction: column; gap: 1px; }
.side-user { padding: 7px 12px; font-size: 12.5px; color: #9aa6b9; display: flex; align-items: center; gap: 9px; }
.side-user .avatar {
  width: 24px; height: 24px; border-radius: 6px; background: #2c3a52; color: #c7d3e6;
  display: grid; place-items: center; font-weight: 700; font-size: 11.5px; flex: none;
}

/* 主区 */
.main { flex: 1; min-width: 0; padding: 24px 28px 50px; max-width: 1200px; }
.view { display: none; animation: viewIn 0.32s var(--ease); }
.view.on { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; color: #141b26; }
.view-head .sub { color: #7b8593; font-size: 12.5px; margin-top: 3px; }

/* 概览 */
.ov-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ov-card { padding: 15px 17px; }
.ov-card .k { color: #67717f; font-size: 12px; font-weight: 500; }
.ov-card .v {
  margin-top: 6px; font-size: 24px; font-weight: 700; color: #141b26;
  font-variant-numeric: tabular-nums; background: none; -webkit-background-clip: initial; background-clip: initial;
  letter-spacing: -0.3px;
}
.ov-card.warn .v { color: #b45309; }
.ov-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.chart-card { padding: 17px 19px; }
.chart-card h3, .recent-card h3 { font-size: 13px; margin-bottom: 12px; color: #3d4756; font-weight: 600; }
#trendChart { width: 100%; height: 230px; display: block; }
.recent-card { padding: 17px 19px; }
.recent-list { display: flex; flex-direction: column; gap: 6px; max-height: 230px; overflow-y: auto; }
.recent-item {
  display: flex; justify-content: space-between; gap: 10px; font-size: 12px;
  padding: 7px 10px; border-radius: 6px; background: #f8f9fb; border: 1px solid #eef0f4;
  color: #3d4756;
}
.recent-item .rc-card { font-family: ui-monospace, Consolas, monospace; color: #263041; }
.recent-item .rc-time { color: #98a2b3; white-space: nowrap; }

/* 工具条 */
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: auto; min-width: 190px; }
.toolbar select.input { min-width: 120px; }
.toolbar .grow { flex: 1; }

.row-actions { display: flex; gap: 4px; }
.card-key { letter-spacing: 0.3px; font-size: 12.3px; }
.tbl input[type="checkbox"] { accent-color: #2456d6; }

/* 生成结果 */
.gen-result {
  margin-top: 4px; padding: 12px 13px; border-radius: 6px; background: #f8f9fb;
  border: 1px solid #e5e8ee; max-height: 210px; overflow: auto;
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.85;
  user-select: all; white-space: pre-wrap; word-break: break-all; color: #263041;
}

/* 上传区 */
.upload-zone {
  border: 1.5px dashed #ccd3dd; border-radius: 8px; padding: 28px 20px; text-align: center;
  color: #7b8593; cursor: pointer; transition: border-color 0.15s, background 0.15s; font-size: 13px;
  background: #fafbfc;
}
.upload-zone:hover, .upload-zone.drag { border-color: #2456d6; background: #f3f7ff; color: #2456d6; }
.upload-zone .big { font-size: 0; margin: 0 0 8px; }

.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; border-radius: 99px; background: #d0d5dd; transition: background 0.2s; cursor: pointer; }
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform 0.2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input:checked + .track { background: #2456d6; }
.switch input:checked + .track::after { transform: translateX(16px); }

/* 查看（软件与模块）应用卡内联样式兼容 */
#appsBox .card { margin-bottom: 10px; }
#appsBox .card > div > div:first-child > div:first-child { color: #141b26; font-weight: 700; font-size: 14px; }

@media (max-width: 960px) {
  .side { width: 56px; min-width: 56px; padding: 12px 7px; }
  .side .logo .logo-text, .side .menu-item span:not(.m-ico), .side .side-user .u-name { display: none; }
  .menu-item { justify-content: center; padding: 10px 0; }
  .main { padding: 18px 14px 40px; }
  .ov-grid { grid-template-columns: 1fr; }
}
