/* 卡密中心 · 样式（单文件，便于二改） */

:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --line: #e3e8ec;
  --text: #16202a;
  --text-2: #5b6b7a;
  --text-3: #93a1ad;
  --brand: #0f766e;
  --brand-2: #0d9488;
  --danger: #b42318;
  --warn: #b45309;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 14px;
}
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-link {
  padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-size: 14px;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--brand); background: rgba(15, 118, 110, .08); font-weight: 600; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who { font-size: 13px; color: var(--text-2); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: .15s ease; line-height: 1.2;
}
.btn:hover { border-color: #cfd8de; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f0c8c4; background: #fff6f5; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 提示 ---------- */
.alert { padding: 10px 14px; border-radius: 10px; margin: 16px 0; font-size: 14px; }
.alert.success { background: #e9f7f3; color: #0b5e57; border: 1px solid #c7ece3; }
.alert.error { background: #fdf0ef; color: var(--danger); border: 1px solid #f4cfcb; }
.alert.warn { background: #fff7e8; color: var(--warn); border: 1px solid #f5e0b8; }

/* ---------- 通用块 ---------- */
.hero { padding: 34px 0 10px; }
.hero h1 { font-size: 30px; margin: 0 0 8px; letter-spacing: -.5px; }
.lead { color: var(--text-2); max-width: 620px; margin: 0 0 16px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

.page-head { padding: 24px 0 8px; }
.page-head h1 { font-size: 24px; margin: 0 0 6px; }
.page-head .muted { margin: 0; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card-title { font-weight: 600; margin-bottom: 6px; }
.notice { margin: 16px 0; border-left: 3px solid var(--brand); }
.notice-body { color: var(--text-2); white-space: pre-wrap; }

.section { margin: 26px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-head h2 { font-size: 17px; margin: 0; }
.more { font-size: 13px; color: var(--text-2); }
.more:hover { color: var(--brand); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }

/* ---------- 商品 ---------- */
.product { display: flex; flex-direction: column; gap: 8px; }
.product-name { font-weight: 650; font-size: 16px; }
.price { font-size: 26px; font-weight: 700; color: var(--brand); letter-spacing: -.5px; }
.price .unit { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.feat { margin: 4px 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.feat li { margin: 2px 0; }
.meta { font-size: 12px; color: var(--text-3); }
.empty {
  padding: 28px; text-align: center; color: var(--text-2);
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
}
.tip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0; flex-wrap: wrap; }

/* ---------- 列表 ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-item { padding: 12px 16px; display: flex; flex-direction: column; gap: 3px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-title { font-weight: 600; color: var(--text); }
.list-meta { font-size: 12px; color: var(--text-3); }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.form-title { margin: 8px 0 0; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-2); }
.field input, .field select, .field textarea, textarea, input, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--text); font: inherit; font-size: 14px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.filter-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 14px 0; }
.filter-form .field { min-width: 160px; }

.auth-wrap { display: flex; justify-content: center; padding: 40px 0; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { margin: 0 0 6px; }
.auth-alt { font-size: 13px; color: var(--text-2); margin: 12px 0 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 14px; }
.table th { text-align: left; padding: 11px 14px; background: var(--surface-2); font-weight: 600; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--line); }
.table td { padding: 11px 14px; border-bottom: 1px solid #f0f3f5; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.t-right { text-align: right; }
.row-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.inline { display: inline; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; }
.mini-input { width: 130px !important; padding: 5px 9px !important; font-size: 13px !important; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; line-height: 1.6; }
.tag.green { background: #e7f6f1; color: #0b6b5f; }
.tag.red { background: #fdecea; color: var(--danger); }
.tag.blue { background: #eaf2fb; color: #1c5d99; }
.tag.gray { background: #f0f3f5; color: var(--text-2); }

.muted { color: var(--text-2); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }

/* ---------- 统计 ---------- */
.stats-row { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.stat .stat-label { font-size: 12px; color: var(--text-3); }
.stat .stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin: 2px 0; }
.stat .stat-value.small { font-size: 17px; }
.profile { display: grid; gap: 8px; }
.kv { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 6px; font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--text-2); }

/* ---------- 社区 ---------- */
.forum-card { display: block; color: inherit; }
.forum-card:hover { text-decoration: none; border-color: #cfe6e2; }
.forum-name { font-weight: 650; font-size: 16px; margin-bottom: 4px; }
.forum-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.post { padding: 22px; }
.post-head h1 { font-size: 22px; margin: 0 0 6px; }
.post-body { margin-top: 14px; color: #26333f; white-space: pre-wrap; }
.replies { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.reply { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.reply-meta { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.reply-body { margin-top: 6px; color: #2b3945; white-space: pre-wrap; }

/* ---------- 聊天 ---------- */
.chat-shell { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.chat-body { height: 420px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, #fbfdfd, #f7fafa); }
.msg { display: flex; flex-direction: column; max-width: 74%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg.system { align-self: center; max-width: 100%; }
.bubble {
  padding: 9px 13px; border-radius: 12px; font-size: 14px; line-height: 1.6;
  background: #fff; border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word;
}
.msg.mine .bubble { background: var(--brand); color: #fff; border-color: var(--brand); border-bottom-right-radius: 4px; }
.msg.theirs .bubble { border-bottom-left-radius: 4px; }
.msg-time { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.msg-system { font-size: 12px; color: var(--text-3); text-align: center; background: #eef3f4; padding: 4px 10px; border-radius: 999px; }
.chat-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: #fff; align-items: flex-end; }
.chat-input textarea { resize: none; min-height: 44px; max-height: 120px; }
.chat-input .btn { height: 44px; }
.chat-tip { font-size: 12px; color: var(--text-3); padding: 0 14px 10px; min-height: 18px; }
.chat-empty { padding: 60px 24px; text-align: center; color: var(--text-2); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- 客服台 / 后台 ---------- */
.agent-layout, .admin-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; margin: 16px 0 40px; align-items: start; }
.agent-side, .admin-nav {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow);
}
.side-block { display: flex; flex-direction: column; gap: 6px; }
.side-title { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.side-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13px;
}
.side-item.link { color: inherit; }
.side-item.link:hover { border-color: #cfe6e2; text-decoration: none; }
.side-item.on { background: #e9f7f3; border-color: #c7ece3; }
.pad { padding: 6px 2px; }
.peer-form { display: flex; gap: 6px; margin-top: 4px; }
.peer-form select { flex: 1; padding: 6px 8px; font-size: 13px; }
.agent-main { min-width: 0; }

.admin-link { padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-size: 14px; }
.admin-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.admin-link.on { background: rgba(15, 118, 110, .08); color: var(--brand); font-weight: 600; }
.admin-main { min-width: 0; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 40px; background: var(--surface); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .agent-layout, .admin-layout { grid-template-columns: 1fr; }
  .chat-body { height: 360px; }
  .hero h1 { font-size: 26px; }
  .nav-right { margin-left: 0; }
}
@media (max-width: 560px) {
  .topbar-inner { gap: 10px; }
  .nav { gap: 2px; }
  .nav-link { padding: 5px 8px; font-size: 13px; }
  .table { min-width: 640px; }
  .msg { max-width: 88%; }
}
