/* PLC110移植线刷工具 授权管理后台样式 */
:root {
  --bg: #070c18;
  --bg-alt: #0b1224;
  --panel: #0f172a;
  --card: #111c33;
  --card-2: #16233d;
  --border: #21304e;
  --border-2: #2d4066;
  --text: #e9f0ff;
  --muted: #8ea1c4;
  --accent: #3b82f6;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(2, 8, 24, .45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 228px;
  flex: 0 0 228px;
  background: linear-gradient(180deg, #0b1426 0%, #080f1f 100%);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }

.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 20px; color: #04121f;
  background: linear-gradient(135deg, #3b82f6, #22d3ee);
  box-shadow: 0 8px 20px rgba(34, 211, 238, .25);
}

.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.nav a:hover { background: rgba(59, 130, 246, .09); color: var(--text); text-decoration: none; }

.nav a.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, .2), rgba(34, 211, 238, .07));
  color: #fff;
  box-shadow: inset 2px 0 0 var(--accent-2);
}

.nav .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 16px; }
.who { font-size: 13px; margin-bottom: 6px; }
.who span { color: var(--muted); }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; padding: 26px 32px 48px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.topbar h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: .3px; }
.top-actions { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }

.flash {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
}
.flash-success { border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .08); color: #a7f3d0; }
.flash-error { border-color: rgba(248, 113, 113, .4); background: rgba(248, 113, 113, .08); color: #fecaca; }
.flash-info { border-color: rgba(59, 130, 246, .4); background: rgba(59, 130, 246, .08); color: #bfdbfe; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .012);
}
.card-title { font-size: 15px; font-weight: 600; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.card-body { padding: 18px 20px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 统计 ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-label { color: var(--muted); font-size: 12px; letter-spacing: .4px; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 8px; }
.stat-value small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; color: var(--muted);
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .015); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid rgba(33, 48, 78, .55); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(59, 130, 246, .045); }
.table .mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; color: #cfe0ff; }
.table .muted { color: var(--muted); }
.table .nowrap { white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; border: 1px solid transparent; white-space: nowrap;
}
.badge-ok { color: #a7f3d0; background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .35); }
.badge-warn { color: #fde68a; background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .35); }
.badge-danger { color: #fecaca; background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .35); }
.badge-muted { color: #cbd5e1; background: rgba(148, 163, 184, .1); border-color: rgba(148, 163, 184, .3); }
.badge-blue { color: #bfdbfe; background: rgba(59, 130, 246, .12); border-color: rgba(59, 130, 246, .35); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: var(--card-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: #1b2c4b; border-color: #37517a; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #2563eb, #0891b2);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .25);
}
.btn-primary:hover { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.btn-danger { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .45); color: #fecaca; }
.btn-danger:hover { background: rgba(248, 113, 113, .2); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input[type="text"], .field input[type="password"], .field input[type="number"],
.field input[type="date"], .field input[type="url"], .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-2);
  background: #0b1528;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 100px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .16);
}
.field .help { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.5; }
.check-row { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 13px; padding: 8px 0; }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }

/* ---------- 提示 / 代码 ---------- */
.code-block {
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
  background: #08101f;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  color: #b8cdf0;
  overflow: auto;
  max-height: 320px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
}
.hint { color: var(--muted); font-size: 12px; line-height: 1.7; }
.hint code, .inline-code {
  font-family: Consolas, monospace;
  background: rgba(148, 163, 184, .12);
  border-radius: 5px;
  padding: 1px 6px;
  color: #c7dbff;
}
.empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 6px; justify-content: flex-end; padding: 14px 20px; }
.pagination a, .pagination span {
  min-width: 34px; height: 34px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--border);
  color: var(--muted); font-size: 13px; text-decoration: none;
}
.pagination a:hover { background: var(--card-2); color: var(--text); text-decoration: none; }
.pagination .current { background: rgba(59, 130, 246, .18); border-color: rgba(59, 130, 246, .5); color: #fff; }

/* ---------- 登录 / 安装 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(900px 500px at 12% 8%, rgba(37, 99, 235, .22), transparent 60%),
    radial-gradient(700px 450px at 88% 92%, rgba(34, 211, 238, .12), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: rgba(17, 28, 51, .92);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 30px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  backdrop-filter: blur(10px);
}
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.auth-brand .brand-mark { width: 46px; height: 46px; border-radius: 14px; font-size: 22px; }
.auth-title { font-size: 19px; font-weight: 700; }
.auth-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.auth-card .field { margin-bottom: 15px; }
.auth-card .btn { width: 100%; padding: 11px; margin-top: 6px; }
.auth-error { color: #fecaca; background: rgba(248, 113, 113, .1); border: 1px solid rgba(248, 113, 113, .35); padding: 10px 13px; border-radius: 9px; font-size: 12px; margin-bottom: 14px; line-height: 1.5; }
.auth-foot { margin-top: 18px; color: var(--muted); font-size: 12px; text-align: center; line-height: 1.7; }
.requirements { margin: 0 0 18px; padding: 0; list-style: none; }
.requirements li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed rgba(45, 64, 102, .55); font-size: 12px; color: var(--muted); }
.requirements li:last-child { border-bottom: none; }
.req-ok { color: var(--ok); }
.req-bad { color: var(--danger); }

/* ---------- 在线客服 ---------- */
.chat-admin {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.chat-users {
  display: flex;
  flex-direction: column;
  max-height: 680px;
  overflow: hidden;
}
.chat-users .card-head { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.chat-user-list { overflow-y: auto; }
.chat-user-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.chat-user-item:hover { background: rgba(59, 130, 246, .08); text-decoration: none; }
.chat-user-item.active { background: rgba(59, 130, 246, .18); border-left: 3px solid var(--accent); }
.chat-user-name { font-weight: 600; font-size: 13px; }
.chat-user-meta { margin-top: 4px; color: var(--muted); font-size: 11px; }
.chat-conv {
  display: flex;
  flex-direction: column;
  min-height: 620px;
  max-height: 760px;
  overflow: hidden;
}
.chat-conv .card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.chat-admin-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  min-height: 320px;
}
.chat-admin-row { display: flex; margin-bottom: 12px; }
.chat-admin-row.user { justify-content: flex-start; }
.chat-admin-row.admin { justify-content: flex-end; }
.chat-admin-bubble {
  max-width: 72%;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  word-break: break-word;
}
.chat-admin-row.admin .chat-admin-bubble {
  background: rgba(59, 130, 246, .18);
  border-color: rgba(59, 130, 246, .42);
}
.chat-admin-meta { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.chat-admin-body { line-height: 1.6; }
.chat-thumb {
  display: block;
  max-width: 280px;
  max-height: 230px;
  margin-top: 7px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.chat-admin-bubble audio { display: block; width: 270px; max-width: 100%; margin-top: 7px; }
.chat-delete { margin-top: 6px; text-align: right; }
.chat-delete button {
  border: 0; background: none; color: var(--danger);
  font-size: 11px; cursor: pointer; opacity: .7; padding: 0;
}
.chat-delete button:hover { opacity: 1; text-decoration: underline; }
.chat-reply {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: rgba(8, 15, 30, .35);
}
.chat-reply textarea {
  flex: 1;
  min-height: 66px;
  resize: vertical;
  background: #0a1426;
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
}
.chat-reply textarea:focus { outline: none; border-color: var(--accent); }
.chat-reply .btn { min-width: 110px; padding: 11px 16px; }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; padding: 14px 16px; }
  .brand { padding-bottom: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { display: none; }
  .main { padding: 20px 16px 36px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .chat-admin { grid-template-columns: 1fr; }
  .chat-users { max-height: 300px; }
}
