/* ============================================================
   简汇云科技 管理后台样式（含登录页）
   ============================================================ */

:root {
  --primary: #0b5fff;
  --primary-dark: #0047d6;
  --cyan: #16c5ff;
  --dark: #0a1633;
  --sidebar: #0c1a3d;
  --text: #1f2733;
  --text-light: #5b6675;
  --text-muted: #8a94a6;
  --bg: #f3f6fb;
  --border: #e6ebf3;
  --radius: 12px;
  --danger: #e54848;
  --success: #18a058;
  --warning: #f0a020;
  --shadow: 0 10px 34px rgba(16, 34, 77, .10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg); font-size: 14.5px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; }
img { display: block; max-width: 100%; }

/* ---------------- 品牌 logo ---------------- */
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff; font-weight: 800; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(11, 95, 255, .35);
}
.brand-logo.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 26px; }
.brand-logo.sm { width: 36px; height: 36px; font-size: 18px; }

/* ---------------- 按钮 ---------------- */
.btn-admin {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border-radius: 9px; font-size: 14px; font-weight: 600;
  transition: all .2s; white-space: nowrap; border: 1px solid transparent;
}
.btn-admin.primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(11, 95, 255, .28); }
.btn-admin.primary:hover { background: var(--primary-dark); }
.btn-admin.ghost { background: #fff; border-color: var(--border); color: var(--text-light); }
.btn-admin.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-admin.danger { background: #fff; border-color: #f3c1c1; color: var(--danger); }
.btn-admin.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-admin.sm { padding: 6px 14px; font-size: 13px; }
.btn-admin.block { width: 100%; padding: 12px; font-size: 15px; margin-top: 8px; }
.btn-admin:disabled { opacity: .6; cursor: not-allowed; }

/* ============================================================
   登录页
   ============================================================ */
.login-body { min-height: 100vh; display: flex; background: #fff; }
.login-wrap { display: flex; width: 100%; min-height: 100vh; }
.login-aside {
  flex: 1.15; position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(150deg, #081130 0%, #10224d 55%, #17367e 100%);
  display: flex; flex-direction: column; justify-content: center; padding: 7% 7%;
}
.login-aside::before, .login-aside::after {
  content: ""; position: absolute; border-radius: 50%;
}
.login-aside::before { width: 460px; height: 460px; right: -140px; top: -120px;
  background: radial-gradient(circle, rgba(22, 197, 255, .25), transparent 70%); }
.login-aside::after { width: 320px; height: 320px; left: -100px; bottom: -100px;
  background: radial-gradient(circle, rgba(11, 95, 255, .35), transparent 70%); }
.login-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 56px; position: relative; z-index: 2; }
.login-brand h2 { font-size: 26px; }
.login-brand p { color: rgba(255, 255, 255, .65); font-size: 14px; }
.login-points { position: relative; z-index: 2; }
.login-points li { display: flex; align-items: center; gap: 12px; margin-bottom: 22px;
  font-size: 16px; color: rgba(255, 255, 255, .88); }
.login-points li span { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 0 5px rgba(22, 197, 255, .18); flex: none; }

.login-panel {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 40px 8%; max-width: 620px; width: 100%; margin: 0 auto;
}
.login-panel h1 { font-size: 30px; color: var(--dark); margin-bottom: 8px; }
.login-sub { color: var(--text-muted); margin-bottom: 38px; }
.af-item { margin-bottom: 20px; }
.af-item label { display: block; font-weight: 600; margin-bottom: 9px; color: var(--dark); }
.af-input input {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--border);
  border-radius: 10px; background: #f8fafd; transition: all .2s;
}
.af-input input:focus { outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 95, 255, .1); }
.login-error { color: var(--danger); font-size: 13.5px; min-height: 20px; margin-bottom: 4px; }
.login-hint { margin-top: 22px; font-size: 13px; color: var(--text-muted); text-align: center;
  background: #f4f7fc; padding: 10px; border-radius: 8px; }
.login-back { display: block; text-align: center; margin-top: 18px; color: var(--text-light); font-size: 13.5px; }
.login-back:hover { color: var(--primary); }

/* ============================================================
   后台布局
   ============================================================ */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex: none; background: var(--sidebar); color: rgba(255, 255, 255, .7);
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 50;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .07); }
.sidebar-brand strong { color: #fff; font-size: 17px; letter-spacing: .5px; }
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar-nav .nav-group { font-size: 11.5px; color: rgba(255, 255, 255, .35);
  letter-spacing: 2px; padding: 16px 12px 8px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 9px;
  color: rgba(255, 255, 255, .72); font-size: 14.5px; margin-bottom: 3px; transition: all .18s;
  position: relative;
}
.sidebar-nav a svg { width: 18px; height: 18px; stroke: currentColor; flex: none; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar-nav a.active { background: linear-gradient(90deg, var(--primary), #2f7bff); color: #fff;
  box-shadow: 0 6px 16px rgba(11, 95, 255, .35); }
.sidebar-nav a .badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 11px;
  min-width: 19px; height: 19px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; padding: 0 5px; font-weight: 700;
}
.sidebar-foot { padding: 16px; border-top: 1px solid rgba(255, 255, 255, .07);
  display: flex; flex-direction: column; gap: 4px; }
.sidebar-foot a, .sidebar-foot button {
  text-align: left; padding: 9px 12px; border-radius: 8px; font-size: 13.5px;
  color: rgba(255, 255, 255, .6); transition: .18s;
}
.sidebar-foot a:hover, .sidebar-foot button:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.admin-main { flex: 1; margin-left: 232px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 28px; position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 19px; color: var(--dark); font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.admin-user {
  display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-light);
  background: var(--bg); padding: 6px 14px; border-radius: 999px;
}
.admin-user::before { content: ""; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  display: inline-block;
  background-image: linear-gradient(135deg, var(--primary), var(--cyan)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8' r='4' fill='white'/%3E%3Cpath d='M4 21c0-4 4-6 8-6s8 2 8 6' fill='white'/%3E%3C/svg%3E");
}
.menu-toggle { display: none; font-size: 22px; color: var(--dark); }

.admin-content { padding: 26px 28px 60px; }

/* ---------------- 卡片 / 概览 ---------------- */
.card { background: #fff; border-radius: var(--radius); box-shadow: 0 4px 18px rgba(16, 34, 77, .05);
  border: 1px solid var(--border); margin-bottom: 22px; }
.card-head { padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; }
.card-head h3 { font-size: 16px; color: var(--dark); }
.card-head .sub { font-size: 13px; color: var(--text-muted); }
.card-head .actions { margin-left: auto; display: flex; gap: 10px; }
.card-body { padding: 22px; }

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 22px;
  border: 1px solid var(--border); position: relative; overflow: hidden; }
.stat-card .ic { width: 46px; height: 46px; border-radius: 12px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center; }
.stat-card .ic svg { width: 23px; height: 23px; }
.stat-card .ic.blue { background: rgba(11, 95, 255, .1); color: var(--primary); }
.stat-card .ic.cyan { background: rgba(22, 197, 255, .14); color: #0891b2; }
.stat-card .ic.green { background: rgba(24, 160, 88, .12); color: var(--success); }
.stat-card .ic.orange { background: rgba(240, 160, 32, .14); color: var(--warning); }
.stat-card .num { font-size: 30px; font-weight: 800; color: var(--dark); line-height: 1.1; }
.stat-card .lb { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.quick-item { display: flex; align-items: center; gap: 13px; padding: 16px;
  border: 1px solid var(--border); border-radius: 10px; transition: .2s; cursor: pointer; background: #fff; }
.quick-item:hover { border-color: var(--primary); box-shadow: 0 8px 20px rgba(11, 95, 255, .1); transform: translateY(-2px); }
.quick-item .qi { width: 40px; height: 40px; border-radius: 10px; background: rgba(11, 95, 255, .08);
  color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.quick-item .qi svg { width: 20px; height: 20px; }
.quick-item b { display: block; font-size: 14.5px; color: var(--dark); }
.quick-item span { font-size: 12.5px; color: var(--text-muted); }

/* ---------------- 表格 / 列表 ---------------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8fafd; text-align: left; padding: 13px 16px; font-size: 13px;
  color: var(--text-light); font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--border); }
.data-table td { padding: 14px 16px; border-bottom: 1px solid #f0f3f9; vertical-align: middle; font-size: 14px; }
.data-table tr:hover td { background: #fafcff; }
.data-table .t-title { font-weight: 600; color: var(--dark); min-width: 200px; }
.data-table .t-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 3px; font-weight: 400; }
.data-table .row-actions { display: flex; gap: 8px; white-space: nowrap; }
.tag-pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px;
  background: rgba(11, 95, 255, .09); color: var(--primary); font-weight: 600; }
.tag-pill.gray { background: #f0f2f6; color: var(--text-muted); }
.tag-pill.green { background: rgba(24, 160, 88, .12); color: var(--success); }
.tag-pill.red { background: rgba(229, 72, 72, .1); color: var(--danger); }
.thumb { width: 76px; height: 48px; border-radius: 7px; object-fit: cover; background: linear-gradient(135deg, #0a1633, #17367e); }
.thumb.square { width: 52px; height: 52px; border-radius: 50%; }
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty svg { width: 52px; height: 52px; stroke: #c6cfdd; margin-bottom: 12px; }

/* ---------------- 表单 ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.form-grid .full { grid-column: 1 / -1; }
.f-item { margin-bottom: 18px; }
.f-item label { display: block; font-size: 13.5px; font-weight: 600; color: var(--dark); margin-bottom: 8px; }
.f-item label .req { color: var(--danger); margin-left: 2px; }
.f-item label .hint { font-weight: 400; color: var(--text-muted); font-size: 12.5px; margin-left: 8px; }
.f-item input[type="text"], .f-item input[type="number"], .f-item input[type="date"],
.f-item input[type="email"], .f-item input[type="tel"], .f-item input[type="password"],
.f-item select, .f-item textarea {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 9px;
  background: #fbfcfe; transition: all .18s; color: var(--text);
}
.f-item textarea { resize: vertical; line-height: 1.7; }
.f-item input:focus, .f-item select:focus, .f-item textarea:focus {
  outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 95, 255, .09);
}
.f-error { color: var(--danger); font-size: 12.5px; margin-top: 5px; display: none; }
.f-item.invalid input, .f-item.invalid textarea, .f-item.invalid select { border-color: var(--danger); }
.f-item.invalid .f-error { display: block; }

/* 图片上传 */
.img-upload { display: flex; align-items: center; gap: 16px; }
.img-preview { width: 130px; height: 82px; border-radius: 9px; border: 1.5px dashed var(--border);
  background: #f8fafd; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 12px; overflow: hidden; flex: none; text-align: center; padding: 6px; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; }
.img-upload .ops { display: flex; flex-direction: column; gap: 8px; }
.img-upload .ops button { font-size: 13px; }
.uploading { color: var(--primary); font-size: 13px; }

/* 图标选择 */
.icon-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.icon-picker label { position: relative; cursor: pointer; }
.icon-picker input { position: absolute; opacity: 0; pointer-events: none; }
.icon-picker .ip-box { height: 48px; border: 1.5px solid var(--border); border-radius: 9px;
  display: flex; align-items: center; justify-content: center; color: var(--text-light); transition: .15s; background: #fbfcfe; }
.icon-picker .ip-box svg { width: 22px; height: 22px; }
.icon-picker input:checked + .ip-box { border-color: var(--primary); color: var(--primary);
  background: rgba(11, 95, 255, .07); box-shadow: 0 0 0 2px rgba(11, 95, 255, .12); }
.icon-picker .ip-box:hover { border-color: var(--primary); color: var(--primary); }

/* 主题选择 */
.theme-picker { display: flex; gap: 10px; }
.theme-picker label { cursor: pointer; flex: 1; }
.theme-picker input { position: absolute; opacity: 0; }
.theme-picker .tp-box { height: 46px; border-radius: 9px; border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 600; }
.theme-picker .tp-blue { background: linear-gradient(135deg, #0b3fd1, #0aa8e8); }
.theme-picker .tp-dark { background: linear-gradient(135deg, #081130, #1d3f8f); }
.theme-picker .tp-cyan { background: linear-gradient(135deg, #075985, #0b5fff); }
.theme-picker input:checked + .tp-box { border-color: var(--dark); box-shadow: 0 0 0 2px #fff inset; }

/* 统计项编辑 */
.stats-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stats-editor .se-row { display: flex; gap: 8px; }
.stats-editor .se-row input { flex: 1; min-width: 0; }
.stats-editor .se-row .se-num { max-width: 110px; }

/* ---------------- 弹窗 ---------------- */
.am-mask { position: fixed; inset: 0; background: rgba(8, 17, 48, .55); backdrop-filter: blur(3px);
  z-index: 100; display: none; align-items: center; justify-content: center; padding: 30px 16px; }
.am-mask.show { display: flex; }
.am-dialog { background: #fff; border-radius: 16px; width: 100%; max-width: 640px;
  max-height: 90vh; display: flex; flex-direction: column; animation: amIn .25s ease; }
.am-dialog.lg { max-width: 820px; }
@keyframes amIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.am-head { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.am-head h3 { font-size: 17px; color: var(--dark); }
.am-close { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; color: var(--text-muted); font-size: 15px; }
.am-close:hover { background: var(--bg); color: var(--danger); }
.am-body { padding: 24px; overflow-y: auto; }
.am-foot { padding: 15px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }

/* 留言详情 */
.msg-detail .msg-row { display: flex; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.msg-detail .msg-row .k { width: 90px; flex: none; color: var(--text-muted); font-size: 13.5px; }
.msg-detail .msg-row .v { color: var(--text); word-break: break-all; }
.msg-detail .msg-content { background: var(--bg); border-radius: 10px; padding: 16px; margin-top: 14px;
  white-space: pre-wrap; line-height: 1.9; color: var(--text); }

/* Toast */
.toast { position: fixed; top: 26px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: var(--dark); color: #fff; padding: 12px 24px; border-radius: 10px; font-size: 14px;
  z-index: 200; opacity: 0; pointer-events: none; transition: all .28s; box-shadow: var(--shadow); max-width: 80vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .28s; }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .menu-toggle { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .login-aside { display: none; }
}
@media (max-width: 640px) {
  .admin-content { padding: 18px 14px 50px; }
  .topbar { padding: 0 16px; }
  .stat-cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px; }
  .icon-picker { grid-template-columns: repeat(4, 1fr); }
  .stats-editor { grid-template-columns: 1fr; }
}
