/* ==========================================================================
   后台管理 · 样式
   ========================================================================== */

:root {
  --a-navy: #0b2545;
  --a-navy-2: #14395c;
  --a-teal: #0f8b84;
  --a-mint: #53e0c6;
  --a-bg: #f4f6f9;
  --a-surface: #fff;
  --a-text: #1b2b3a;
  --a-muted: #6b7f90;
  --a-line: #e3e9ef;
  --a-danger: #c0392b;
  --a-radius: 12px;
  --a-shadow: 0 1px 2px rgba(11, 37, 69, .05), 0 8px 24px rgba(11, 37, 69, .06);
  --a-font: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --a-mono: "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--a-font); background: var(--a-bg); color: var(--a-text);
  font-size: 14px; line-height: 1.65; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--a-teal); outline-offset: 2px; }

/* ------------------------------ 侧边栏 ------------------------------- */

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

.side {
  position: fixed; inset: 0 auto 0 0; width: 236px; z-index: 30;
  background: linear-gradient(175deg, #071a2b, #0b2545 55%, #0d2f4a);
  color: #cddbe6; display: flex; flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.side-mark {
  width: 36px; height: 36px; border-radius: 9px; flex: 0 0 36px;
  display: grid; place-items: center; font-family: var(--a-mono); font-size: 12px; font-weight: 700;
  background: linear-gradient(135deg, var(--a-teal), var(--a-mint)); color: #04211e; letter-spacing: .04em;
}
.side-name { display: flex; flex-direction: column; min-width: 0; font-size: 14px; font-weight: 700; color: #fff; }
.side-name em { font-style: normal; font-size: 11px; font-weight: 400; color: #7d95a9; letter-spacing: .06em; margin-top: 2px; }

.side-nav { flex: 1; overflow-y: auto; padding: 16px 12px 20px; }
.side-group { margin-bottom: 18px; }
.side-label {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #62798d;
  padding: 0 10px 8px; font-weight: 600;
}
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; color: #c2d3e0; transition: background .16s, color .16s; margin-bottom: 2px;
}
.side-link i { font-style: normal; width: 16px; text-align: center; color: #7f97aa; font-size: 13px; }
.side-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-link.is-on { background: rgba(15, 139, 132, .22); color: #fff; box-shadow: inset 2px 0 0 var(--a-mint); }
.side-link.is-on i { color: var(--a-mint); }
.side-foot { padding: 16px 20px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12.5px; }
.side-foot a { color: #8ba3b6; }
.side-foot a:hover { color: var(--a-mint); }

/* ------------------------------ 主区域 ------------------------------- */

.adm-main { flex: 1; min-width: 0; margin-left: 236px; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20; height: 62px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: rgba(255, 255, 255, .95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--a-line);
}
.topbar h1 { font-size: 15.5px; color: var(--a-navy); letter-spacing: .01em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { font-size: 12.5px; color: var(--a-muted); padding: 4px 10px; background: #eef2f6; border-radius: 999px; }
.side-toggle {
  display: none; width: 34px; height: 34px; border: 1px solid var(--a-line); background: #fff;
  border-radius: 8px; color: var(--a-navy); font-size: 16px; line-height: 1;
}
.inline-form { display: inline; }

.page { padding: 26px 28px 90px; max-width: 1320px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; color: var(--a-navy); margin-bottom: 5px; letter-spacing: -.01em; }
.page-head p { font-size: 13px; color: var(--a-muted); max-width: 60em; }
.page-acts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

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

.btn-primary, .btn-sec {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; transition: .18s; white-space: nowrap;
}
.btn-primary { background: var(--a-navy); color: #fff; }
.btn-primary:hover { background: var(--a-navy-2); box-shadow: 0 6px 16px rgba(11, 37, 69, .18); }
.btn-sec { background: #fff; border-color: var(--a-line); color: #33475a; }
.btn-sec:hover { border-color: #b9c8d4; background: #fbfcfd; }
.btn-sec--sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-sec--danger { color: var(--a-danger); }
.btn-block { width: 100%; height: 42px; }

.mini-link {
  background: none; border: 0; padding: 0; font-size: 12.5px; color: var(--a-teal); font-weight: 600;
}
.mini-link:hover { text-decoration: underline; }
.mini-link--danger { color: var(--a-danger); }

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

.card { background: var(--a-surface); border: 1px solid var(--a-line); border-radius: var(--a-radius); margin-bottom: 20px; padding: 22px 24px; }
.card--flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-head--pad { padding: 18px 22px 14px; margin-bottom: 0; }
.card-head h3 { font-size: 14.5px; color: var(--a-navy); }
.card-desc { font-size: 12.5px; color: var(--a-muted); margin: -8px 0 16px; }
.muted { font-size: 12.5px; color: var(--a-muted); }

.cols { display: grid; grid-template-columns: 1.55fr 1fr; gap: 20px; align-items: start; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: #fff; border: 1px solid var(--a-line); border-radius: var(--a-radius); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px; transition: .18s;
}
.stat-card:hover { border-color: #bfd0dc; box-shadow: var(--a-shadow); transform: translateY(-2px); }
.stat-card span { font-size: 12px; color: var(--a-muted); }
.stat-card b { font-size: 26px; color: var(--a-navy); letter-spacing: -.02em; line-height: 1.15; }

/* 安全列表 */
.sec-list { display: grid; gap: 12px; }
.sec-list li { display: flex; gap: 10px; align-items: flex-start; }
.sec-list b { display: block; font-size: 13px; color: #26394a; font-weight: 600; }
.sec-list em { font-style: normal; display: block; font-size: 11.5px; color: var(--a-muted); line-height: 1.6; }
.dot { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--a-teal); margin-top: 7px; box-shadow: 0 0 0 3px rgba(15, 139, 132, .14); }

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

.tbl { font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: #7d8f9e;
  font-weight: 600; padding: 11px 14px; background: #f8fafc; border-bottom: 1px solid var(--a-line); white-space: nowrap;
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid #eef2f6; vertical-align: middle; color: #33475a; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafcfd; }
.tbl--list .cell-main a { font-weight: 600; color: var(--a-navy); font-size: 13.5px; }
.tbl--list .cell-main a:hover { color: var(--a-teal); }
.cell-sub { display: block; font-size: 11.5px; color: #93a3b1; margin-top: 2px; font-weight: 400; }
.cell-acts { white-space: nowrap; text-align: right; }
.cell-acts > * { margin-left: 12px; }
.cell-acts > *:first-child { margin-left: 0; }
.th-acts { text-align: right; }
.cell-msg p { max-width: 320px; font-size: 12.5px; color: #465a6b; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--a-mono); font-size: 11.8px; color: #6b7f90; }
.empty { text-align: center; color: #93a3b1; padding: 40px 10px !important; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  letter-spacing: .02em; white-space: nowrap;
}
.badge--on { background: rgba(15, 139, 132, .1); color: #0b6d67; }
.badge--off { background: #eef2f6; color: #7d8f9e; }
.badge--log { background: #eef2f6; color: #56697a; font-family: var(--a-mono); font-size: 10.5px; }

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

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: #3c5062; letter-spacing: .01em; }
.field .req { color: var(--a-danger); font-style: normal; }
.field input[type="text"], .field input[type="number"], .field input[type="datetime-local"],
.field textarea, .fl input {
  width: 100%; border: 1px solid #d8e1e9; border-radius: 8px; padding: 9px 12px;
  font-size: 13.5px; background: #fcfdfe; transition: border-color .16s, box-shadow .16s;
}
.field textarea { resize: vertical; line-height: 1.7; font-family: var(--a-font); }
.field input:focus, .field textarea:focus, .fl input:focus {
  outline: none; border-color: var(--a-teal); box-shadow: 0 0 0 3px rgba(15, 139, 132, .12); background: #fff;
}
.hint { font-size: 11.5px; color: #93a3b1; line-height: 1.5; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span {
  width: 40px; height: 22px; border-radius: 999px; background: #d5dee6; position: relative; transition: .2s; flex: 0 0 40px;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.switch input:checked + span { background: var(--a-teal); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch em { font-style: normal; font-size: 12.5px; color: #56697a; }
.switch input:focus-visible + span { outline: 2px solid var(--a-teal); outline-offset: 2px; }

/* 上传 */
.up { display: flex; flex-direction: column; gap: 10px; }
.up-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.up-preview {
  width: 132px; height: 90px; border-radius: 9px; border: 1px dashed #cdd8e2; background: #fafcfd;
  display: grid; place-items: center; overflow: hidden; flex: 0 0 132px;
}
.up-preview--img { background: #f3f6f9; }
.up-preview img { width: 100%; height: 100%; object-fit: contain; }
.up-empty { font-size: 11.5px; color: #9aa9b6; text-align: center; padding: 0 8px; }
.up-filename { font-size: 11px; color: #56697a; padding: 0 8px; word-break: break-all; text-align: center; }
.up-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.up-tip { flex: 1 1 100%; font-size: 11.5px; color: #93a3b1; }
.up-tip.is-err { color: var(--a-danger); }
.up-tip.is-ok { color: var(--a-teal); }

.stack-form { display: grid; gap: 14px; max-width: 380px; }
.fl { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: #3c5062; }

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

.alert { border-radius: 9px; padding: 11px 16px; font-size: 13px; margin-bottom: 18px; border: 1px solid transparent; }
.alert--ok { background: rgba(15, 139, 132, .07); border-color: rgba(15, 139, 132, .22); color: #0a6b64; }
.alert--err { background: rgba(192, 57, 43, .06); border-color: rgba(192, 57, 43, .2); color: #a5352a; }
.alert--warn { background: #fff8e8; border-color: #f0dcae; color: #8a6416; }

.sticky-save {
  position: sticky; bottom: 0; margin-top: 4px; padding: 12px 18px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
  border: 1px solid var(--a-line); border-radius: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  box-shadow: 0 -6px 20px rgba(11, 37, 69, .06); font-size: 12px; color: var(--a-muted);
}

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

.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 30px 20px;
  background:
    radial-gradient(700px 340px at 78% 8%, rgba(23, 179, 168, .28), transparent 65%),
    linear-gradient(150deg, #071a2b, #0b2545 60%, #103b56);
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: #fff; border-radius: 16px; padding: 34px 32px 28px; box-shadow: 0 24px 60px rgba(3, 14, 24, .38);
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.login-brand strong { display: block; font-size: 14px; color: var(--a-navy); }
.login-brand em { display: block; font-style: normal; font-size: 11.5px; color: #93a3b1; letter-spacing: .06em; }
.login-card h1 { font-size: 20px; color: var(--a-navy); margin-bottom: 8px; }
.login-tip { font-size: 12.5px; color: var(--a-muted); margin-bottom: 20px; line-height: 1.6; }
.login-card form { display: grid; gap: 14px; margin-top: 4px; }
.login-card .fl input { padding: 10px 12px; font-size: 14px; }
.login-foot { margin-top: 18px; font-size: 12.5px; text-align: center; }
.login-foot a { color: #7d8f9e; }
.login-foot a:hover { color: var(--a-teal); }
.login-note { text-align: center; color: rgba(214, 228, 238, .55); font-size: 11.5px; margin-top: 18px; }

/* ------------------------------ 响应式 ------------------------------- */

@media (max-width: 1180px) {
  .cols { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .side { transform: translateX(-100%); transition: transform .22s ease; }
  .side.is-open { transform: none; box-shadow: 12px 0 40px rgba(3, 14, 24, .3); }
  .adm-main { margin-left: 0; }
  .side-toggle { display: block; }
  .topbar { padding: 0 18px; }
  .page { padding: 20px 18px 80px; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .page-head { flex-direction: column; align-items: flex-start; }
  .card { padding: 18px; }
  .card--flush { overflow-x: auto; }
  .tbl { min-width: 620px; }
  .cell-acts > * { margin-left: 8px; }
}
