/* 在线客服 · 管理后台 样式 */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #e6e9f0;
  --text: #1f2430;
  --muted: #8a93a5;
  --brand: #1d8fea;
  --brand-dark: #1577c9;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(20, 30, 50, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: none; background: none; }
input, select { font: inherit; }

/* ---------------------------------------------------------- 登录 */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eef4fb 0%, #f7f9fc 50%, #eaf1f8 100%);
  padding: 24px;
}
.login-card {
  width: min(400px, 100%); background: #fff; border-radius: 18px;
  box-shadow: 0 18px 50px rgba(20, 40, 80, .12); padding: 34px 30px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 5px rgba(29,143,234,.14); }
.login-title { font-size: 20px; font-weight: 700; }
.login-sub { font-size: 12px; color: var(--muted); }
.login-hint { color: var(--muted); font-size: 13px; margin: 10px 0 22px; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; outline: none; background: #fbfcfe; transition: .15s;
}
.field input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(29,143,234,.1); }
.field.inline { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.field.inline > span { width: 96px; flex: none; margin: 0; }
.field.inline input { flex: 1; }

.btn-primary {
  width: 100%; padding: 11px 20px; border-radius: 10px; color: #fff;
  background: var(--brand); font-weight: 600; transition: .15s;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary.inline { width: auto; padding: 9px 20px; }
.btn-ghost {
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  color: var(--text); background: #fff; transition: .15s;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.form-msg { font-size: 13px; color: var(--bad); margin-top: 10px; min-height: 18px; }

/* ---------------------------------------------------------- 布局 */
.app { display: flex; min-height: 100vh; }
.side {
  width: 208px; flex: none; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.side-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 10px 18px; }
.side-brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.side-nav { flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 10px; color: #4a5265; margin-bottom: 4px;
  text-align: left; transition: .15s;
}
.nav-item:hover { background: #f2f6fb; color: var(--brand); }
.nav-item.active { background: rgba(29,143,234,.1); color: var(--brand); font-weight: 600; }
.nav-item i { width: 18px; height: 18px; border-radius: 5px; background: currentColor; opacity: .35; display: inline-block; }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; }
.side-user { font-size: 12px; color: var(--muted); padding: 0 12px 8px; }
.side-foot .btn-ghost { width: 100%; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; flex: none; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; }
.topbar-right { display: flex; gap: 8px; }
.pill { padding: 5px 12px; border-radius: 999px; background: #f1f5fb; color: #4a5265; font-size: 12px; }
.content { flex: 1; padding: 20px 24px; overflow: auto; }

/* ---------------------------------------------------------- 卡片 */
.card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-num.ok { color: var(--ok); }
.stat-num.warn { color: var(--warn); }
.stat-num.bad { color: var(--bad); }
.stat-cap { font-size: 12px; color: var(--muted); margin-top: 4px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: 650; margin-bottom: 14px; }

/* ---------------------------------------------------------- 工具栏 */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar-tip { flex: 1; font-size: 12px; color: var(--muted); }
.search, .select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none; }
.search { width: 260px; }
.search:focus, .select:focus { border-color: var(--brand); }

/* ---------------------------------------------------------- 表格 */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th, .grid td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid th { background: #fafbfd; font-weight: 600; color: #5a6274; font-size: 12px; }
.grid tbody tr:hover { background: #f8fbff; }
.grid tbody tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.dim { color: var(--muted); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; }
.tag.ok { background: rgba(22,163,74,.1); color: var(--ok); }
.tag.warn { background: rgba(217,119,6,.1); color: var(--warn); }
.tag.bad { background: rgba(220,38,38,.1); color: var(--bad); }
.tag.info { background: rgba(29,143,234,.1); color: var(--brand); }
.tag.muted { background: #f1f3f7; color: var(--muted); }
.row-acts { display: flex; gap: 6px; }
.link-btn { color: var(--brand); font-size: 12px; padding: 2px 4px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--bad); }
.empty { padding: 40px; text-align: center; color: var(--muted); font-size: 13px; }
.pager { display: flex; gap: 6px; justify-content: flex-end; margin-top: 14px; }
.pager button { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; }
.pager button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------------------------------------------------------- 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(15,25,45,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal-card { background: #fff; border-radius: 16px; padding: 26px; width: min(440px, 100%); box-shadow: 0 24px 60px rgba(10,20,40,.25); }
.modal-card.wide { width: min(640px, 100%); }
.modal-card h2 { margin: 0 0 6px; font-size: 17px; }
.modal-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dm-status { margin-top: 6px; }
.dm-bar { height: 6px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.dm-bar i { display: block; height: 100%; width: 20%; background: var(--brand); transition: width .3s; }
.dm-msg { font-size: 12px; color: var(--muted); margin-top: 8px; white-space: pre-wrap; word-break: break-all; }
.detail-body { font-size: 13px; }
.detail-body dl { display: grid; grid-template-columns: 96px 1fr; gap: 8px 14px; margin: 0; }
.detail-body dt { color: var(--muted); }
.detail-body dd { margin: 0; word-break: break-all; }
.copy-row { display: flex; gap: 8px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.copy-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-family: ui-monospace, monospace; font-size: 12px; }

/* ---------------------------------------------------------- 其他 */
.chart { height: 200px; display: flex; align-items: flex-end; gap: 10px; padding: 10px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart-bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, #4aa8f0, var(--brand)); border-radius: 6px 6px 0 0; min-height: 3px; }
.chart-label { font-size: 11px; color: var(--muted); }
.chart-value { font-size: 11px; color: #4a5265; }
.doc { margin: 0; padding-left: 20px; color: #4a5265; font-size: 13px; }
.doc li { margin-bottom: 8px; }
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2430; color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 13px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }

@media (max-width: 760px) {
  .side { width: 60px; padding: 14px 8px; }
  .side-brand span:last-child, .nav-item { font-size: 0; }
  .nav-item i { font-size: 12px; }
  .content { padding: 14px; }
}
