/* 管理后台样式 */
:root {
  --c-green: #07C160;
  --c-green-d: #06AD56;
  --c-bg: #F5F6F8;
  --c-card: #FFFFFF;
  --c-line: #EBEDF0;
  --c-text: #1F2329;
  --c-sub: #8A8F99;
  --c-red: #F54A45;
  --c-blue: #3370FF;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--c-bg); color: var(--c-text); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
input, select, textarea, button { font-family: inherit; font-size: 14px; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--c-blue); text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* 登录 */
.admin-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 34px 30px 30px; box-shadow: 0 8px 30px rgba(0,0,0,.06); }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p { color: var(--c-sub); font-size: 13px; margin: 0 0 26px; }
.inp { width: 100%; height: 42px; border: 1px solid #DCDFE6; border-radius: 8px; padding: 0 12px; outline: 0; background: #fff; transition: border .15s; }
.inp:focus { border-color: var(--c-green); }
.inp + .inp { margin-top: 12px; }
.btn { height: 40px; padding: 0 18px; border-radius: 8px; background: var(--c-green); color: #fff; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s; }
.btn:hover { background: var(--c-green-d); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--c-text); border: 1px solid #DCDFE6; }
.btn.ghost:hover { background: #F7F8FA; }
.btn.danger { background: #fff; color: var(--c-red); border: 1px solid #F5C2C0; }
.btn.danger:hover { background: #FEF0F0; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 6px; }
.btn.link { background: none; color: var(--c-blue); padding: 0 6px; height: auto; }
.btn.link.red { color: var(--c-red); }
.err { color: var(--c-red); font-size: 13px; min-height: 18px; margin: 10px 0; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.side { width: 208px; background: #fff; border-right: 1px solid var(--c-line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 22px 20px 18px; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.brand .dot { width: 26px; height: 26px; border-radius: 7px; background: var(--c-green); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; }
.menu { padding: 6px 10px; flex: 1; }
.menu a { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 8px; color: #4E5969; font-size: 14px; margin-bottom: 2px; }
.menu a:hover { background: #F5F6F8; }
.menu a.active { background: #E8F8EE; color: #07873F; font-weight: 500; }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--c-line); color: var(--c-sub); font-size: 12px; }
.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; font-weight: 600; }
.page-head .spacer { flex: 1; }
.page-head .hint { color: var(--c-sub); font-size: 13px; }

/* 卡片 */
.card { background: var(--c-card); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card + .card { margin-top: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title .sub { font-weight: 400; color: var(--c-sub); font-size: 12px; }

/* 统计 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: var(--radius); padding: 16px 18px; border: 1px solid #F0F1F3; }
.stat .label { color: var(--c-sub); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 600; margin-top: 6px; letter-spacing: -.5px; }
.stat .value.green { color: #07873F; }
.stat .value.blue { color: var(--c-blue); }
.stat .value.red { color: var(--c-red); }

/* 图表 */
.chart { display: flex; align-items: flex-end; gap: 12px; height: 170px; padding: 10px 4px 0; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, #4CD68A, #07C160); border-radius: 4px 4px 0 0; min-height: 3px; transition: height .3s; position: relative; }
.chart .bar.blue { background: linear-gradient(180deg, #7BA5FF, #3370FF); }
.chart .d { font-size: 11px; color: var(--c-sub); }
.chart .v { font-size: 11px; color: #4E5969; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table th { text-align: left; font-weight: 500; color: var(--c-sub); font-size: 13px; padding: 10px 12px; background: #FAFBFC; white-space: nowrap; }
table td { padding: 11px 12px; border-top: 1px solid var(--c-line); vertical-align: middle; }
table tr:hover td { background: #FBFCFD; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; line-height: 18px; }
.tag.green { background: #E8F8EE; color: #07873F; }
.tag.gray { background: #F2F3F5; color: #6B7280; }
.tag.red { background: #FEF0F0; color: var(--c-red); }
.tag.blue { background: #EEF3FF; color: var(--c-blue); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: #4E5969; }
.muted { color: var(--c-sub); }
.nowrap { white-space: nowrap; }
.avatar-mini { width: 28px; height: 28px; border-radius: 5px; object-fit: cover; background: #E5E7EB; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; vertical-align: middle; }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .inp { width: 220px; height: 36px; }
.toolbar select { height: 36px; border: 1px solid #DCDFE6; border-radius: 8px; padding: 0 8px; background: #fff; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding-top: 14px; color: var(--c-sub); font-size: 13px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { width: 100%; max-width: 460px; background: #fff; border-radius: 12px; padding: 22px 24px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal .field { margin-bottom: 12px; }
.modal .field label { display: block; font-size: 13px; color: #4E5969; margin-bottom: 6px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* 消息气泡（后台查看聊天记录用） */
.log-list { max-height: 60vh; overflow-y: auto; background: #F5F6F8; border-radius: 8px; padding: 12px; }
.log-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-start; }
.log-row.me { flex-direction: row-reverse; }
.log-bubble { background: #fff; border-radius: 6px; padding: 7px 10px; max-width: 70%; font-size: 13.5px; line-height: 1.45; word-break: break-word; white-space: pre-wrap; }
.log-row.me .log-bubble { background: #D6F5C8; }
.log-meta { font-size: 11px; color: var(--c-sub); margin-bottom: 3px; }

.empty-state { text-align: center; color: var(--c-sub); padding: 46px 0; font-size: 13px; }
.toast { position: fixed; left: 50%; top: 24px; transform: translateX(-50%); background: rgba(0,0,0,.78); color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; z-index: 99; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { padding: 12px 14px; }
  .menu { display: flex; padding: 6px; gap: 4px; }
  .menu a { white-space: nowrap; margin: 0; padding: 8px 10px; }
  .side-foot { display: none; }
  .main { padding: 14px; }
  .toolbar .inp { width: 140px; }
}
