/* 仪皇客服工作台 · 统一样式
   配色：深蓝灰侧栏 + 浅色工作区 + 蓝色强调
   原则：大字、留白、未读高对比、手机可用
*/
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1a2332;
  --ink-2: #5a6b82;
  --ink-3: #8b9ab0;
  --line: #e3e8f0;
  --brand: #2563eb;
  --brand-dk: #1d4ed8;
  --brand-lt: #eff4ff;
  --side: #16233a;
  --side-2: #1f3050;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --unread: #ef4444;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 32, 56, .08), 0 8px 24px rgba(16, 32, 56, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dk); }

/* ── 顶栏 ── */
.topbar {
  height: 58px;
  background: var(--side);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .5px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.topbar .brand small {
  font-size: 11px;
  font-weight: 400;
  color: #7f93b5;
  letter-spacing: .3px;
}
.topbar nav { display: flex; gap: 4px; margin-left: 12px; }
.topbar nav a {
  color: #b9c6dc;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.topbar nav a:hover { background: var(--side-2); color: #fff; }
.topbar nav a.on { background: var(--brand); color: #fff; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; color: #b9c6dc; display: flex; align-items: center; gap: 12px; }
.topbar .who b { color: #fff; font-weight: 600; }
.badge-unread {
  background: var(--unread);
  color: #fff;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  display: inline-block;
}

/* ── 布局 ── */
.wrap { max-width: 1560px; margin: 0 auto; padding: 20px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-h {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-h .sub { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.card-b { padding: 16px 18px; }

/* ── 工作台三栏 ── */
.wb {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  gap: 14px;
  height: calc(100vh - 58px - 40px);
  min-height: 580px;
}
@media (max-width: 1180px) {
  .wb { grid-template-columns: 260px minmax(0, 1fr); }
  .wb .col-right { display: none; }
}
@media (max-width: 820px) {
  .wb { grid-template-columns: 1fr; height: auto; }
  .wb .col-left { max-height: 240px; }
  .wb .col-right { display: block; }
  .wrap { padding: 10px; }
}

.col { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

/* 店铺切换 */
.shopbar {
  display: flex; gap: 6px; padding: 10px 12px; overflow-x: auto;
  border-bottom: 1px solid var(--line); background: #fbfcfe;
  scrollbar-width: none;
}
.shopbar::-webkit-scrollbar { display: none; }
.shopbar a {
  white-space: nowrap; font-size: 12.5px; padding: 5px 11px;
  border-radius: 999px; border: 1px solid var(--line);
  color: var(--ink-2); background: #fff;
}
.shopbar a.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.shopbar a .u { color: var(--unread); font-weight: 700; }
.shopbar a.on .u { color: #fff; }

/* 会话列表 */
.convlist { overflow-y: auto; flex: 1; }
.convitem {
  display: block; padding: 13px 15px; border-bottom: 1px solid var(--line);
  color: var(--ink); position: relative;
}
.convitem:hover { background: #f7f9fc; }
.convitem.on { background: var(--brand-lt); }
.convitem.on::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--brand);
}
.convitem .r1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.convitem .name { font-weight: 600; font-size: 14px; }
.convitem .time { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.convitem .prev {
  font-size: 12.5px; color: var(--ink-2); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.convitem .tags { margin-top: 6px; display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.tag {
  font-size: 11px; padding: 1px 7px; border-radius: 4px;
  background: #eef2f8; color: var(--ink-2);
}
.tag.site { background: #e0ecff; color: #1e40af; font-weight: 600; }
.tag.intent { background: #f0fdf4; color: #15803d; }
.tag.mode { background: #fef3c7; color: #92400e; }

/* 对话区 */
.chat-h {
  padding: 13px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.chat-h .bname { font-weight: 700; font-size: 15px; }
.chat-body {
  flex: 1; overflow-y: auto; padding: 18px;
  background: linear-gradient(180deg, #fafbfd, #f4f6f9);
}
.msg { display: flex; align-items: flex-start; margin-bottom: 16px; gap: 10px; }
.msg.me { flex-direction: row-reverse; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: #dbe4f3; color: #3b5478;
}
.msg.me .avatar { background: var(--brand); color: #fff; flex-shrink: 0; }
.bubble-wrap { max-width: 72%; flex: 0 1 auto; min-width: 0; }
.bubble {
  padding: 10px 14px; border-radius: 12px; background: #fff;
  border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(16,32,56,.05);
  word-break: break-word;
}
.bubble .txt, .bubble .orig, .bubble .zh { white-space: pre-wrap; }
.msg.me .bubble { background: #dbeafe; color: var(--ink); border-color: #bfdbfe; }
.bubble .orig { font-size: 13.5px; color: var(--ink-2); }
.msg.me .bubble .orig { color: var(--ink-2); }
.bubble .zh {
  margin-top: 7px; padding-top: 7px; border-top: 1px dashed rgba(0,0,0,.12);
  font-size: 13.5px; color: var(--ink);
}
.msg.me .bubble .zh { color: var(--ink-2); border-top-color: rgba(37,99,235,.25); }
.bubble .lang {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--ink-3); margin-bottom: 4px;
}
.msg.me .bubble .lang { color: #3b82f6; }
.meta { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.msg.me .meta { text-align: right; }
.risk-flag {
  display: inline-block; margin-top: 5px; font-size: 11px;
  background: #fef2f2; color: var(--danger); border: 1px solid #fecaca;
  padding: 1px 8px; border-radius: 4px; font-weight: 600;
}

/* 回复区 */
.composer { border-top: 1px solid var(--line); padding: 12px 14px; background: #fff; }
.composer textarea {
  width: 100%; min-height: 62px; max-height: 180px; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-size: 15px; font-family: inherit; line-height: 1.6;
}
.composer textarea:focus { outline: 2px solid var(--brand-lt); border-color: var(--brand); }
.composer .row {
  display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap;
}
.composer .preview {
  flex: 1; min-width: 200px; font-size: 13px; color: var(--ink-2);
  background: #f7f9fc; border: 1px dashed var(--line); border-radius: 8px;
  padding: 8px 11px; min-height: 36px;
}
.composer .preview b { color: var(--ink); }
.btn {
  border: 0; border-radius: 8px; padding: 9px 20px; font-size: 14px;
  font-weight: 600; cursor: pointer; background: var(--brand); color: #fff;
  font-family: inherit;
}
.btn:hover { background: var(--brand-dk); }
.btn.ghost { background: #eef2f8; color: var(--ink-2); }
.btn.ghost:hover { background: #e2e8f2; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 模板条 */
.tplbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; max-height: 62px; overflow-y: auto; }
.tplbar button {
  font-size: 12px; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  cursor: pointer; font-family: inherit;
}
.tplbar button:hover { border-color: var(--brand); color: var(--brand); }

/* 右栏信息 */
.info-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px;
}
.info-row:last-child { border-bottom: 0; }
.info-row .k { color: var(--ink-3); white-space: nowrap; }
.info-row .v { font-weight: 600; text-align: right; word-break: break-all; }

/* 登录页 */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, #1e3a5f 0%, #16233a 45%, #0d1726 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 16px;
  padding: 38px 34px; box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: .5px; }
.login-card .sub { color: var(--ink-3); font-size: 13px; margin-bottom: 26px; }
.login-card label { display: block; font-size: 13px; color: var(--ink-2); margin: 14px 0 6px; font-weight: 600; }
.login-card input {
  width: 100%; padding: 12px 14px; font-size: 15px; border: 1px solid var(--line);
  border-radius: 8px; font-family: inherit;
}
.login-card input:focus { outline: 2px solid var(--brand-lt); border-color: var(--brand); }
.login-card .btn { width: 100%; margin-top: 22px; padding: 12px; font-size: 15px; }
.err {
  background: #fef2f2; color: var(--danger); border: 1px solid #fecaca;
  border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-top: 16px;
}

/* 通用小件 */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.kpi .n { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.kpi .l { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; padding: 9px 10px; background: #f7f9fc;
  border-bottom: 1px solid var(--line); color: var(--ink-2); font-weight: 600;
  white-space: nowrap;
}
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.tbl tr:last-child td { border-bottom: 0; }
.pill { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.pill.on { background: #dcfce7; color: #15803d; }
.pill.off { background: #f1f5f9; color: #64748b; }
.pill.warn { background: #fef3c7; color: #92400e; }
.empty { text-align: center; color: var(--ink-3); padding: 60px 20px; font-size: 14px; }
