/* 荷马口腔 · 通话录音客户管理系统 */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #e4e8ef;
  --line-2: #eef1f6;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #0e7490;
  --brand-d: #0b5c73;
  --brand-l: #e6f4f7;
  --ok: #0f9d58;
  --ok-l: #e8f6ee;
  --warn: #c2740a;
  --warn-l: #fdf3e3;
  --danger: #d64545;
  --danger-l: #fdeeee;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 6px 20px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #eef7f9 0%, #f6f8fb 55%, #eaf1f7 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 34px 32px 26px;
  text-align: center;
}
.brand-mark { font-size: 34px; line-height: 1; }
.login-card h1 { margin: 10px 0 2px; font-size: 21px; letter-spacing: .5px; }
.login-card .sub { margin: 0 0 24px; color: var(--muted); font-size: 12.5px; }
.fld { display: block; text-align: left; margin-bottom: 14px; }
.fld span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.fld input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; outline: none; transition: .15s;
  background: #fcfdfe; color: var(--text);
}
.fld input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(14, 116, 144, .1); }
.login-err { color: var(--danger); font-size: 12.5px; min-height: 18px; text-align: left; margin-bottom: 8px; }
.login-card .tip { margin: 16px 0 0; font-size: 11.5px; color: #9aa4b2; }

/* 登录页身份卡 */
.role-pick { text-align: left; margin-bottom: 18px; }
.role-pick-lbl { font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-card {
  display: block; text-align: left; cursor: pointer; font: inherit;
  padding: 9px 11px; border-radius: var(--radius); border: 1px solid var(--line);
  background: #f8fafc; color: var(--text); transition: .15s;
}
.role-card:hover { border-color: var(--brand); background: var(--brand-l); }
.role-card b { display: block; font-size: 14px; }
.role-card span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.role-card.on { border-color: var(--brand); background: var(--brand-l); box-shadow: 0 0 0 2px rgba(14, 116, 144, .15); }
.role-card.on b { color: var(--brand); }

/* 只读账号标记 */
.ro-tag {
  font-size: 12px; color: var(--warn); background: var(--warn-l);
  border: 1px solid #f2dcb8; border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 208px; flex: 0 0 208px; background: #0f2231; color: #c7d3de;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 8px; padding: 20px 18px 16px; font-size: 15px; color: #fff; }
.logo span { font-size: 20px; }
#nav { flex: 1; padding: 6px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px; margin-bottom: 3px;
  border-radius: 8px; color: #aebdcb; font-size: 13.5px; cursor: pointer;
  text-decoration: none; transition: .15s; user-select: none;
}
.nav-item i { font-style: normal; font-size: 15px; width: 18px; text-align: center; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.badge {
  margin-left: auto; background: #e2504a; color: #fff; font-size: 11px;
  padding: 1px 7px; border-radius: 10px; font-weight: 600;
}
.badge[data-zero="1"] { display: none; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .1); }
.who { margin-bottom: 8px; }
.who b { display: block; color: #fff; font-size: 13px; }
.who span { font-size: 11.5px; color: #8fa1b1; }
.side-foot .btn { width: 100%; margin-bottom: 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 17px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.scan-hint { font-size: 12px; color: var(--muted); }
.content { padding: 20px 24px 88px; }

/* ---------- 通用 ---------- */
.btn {
  border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; font-size: 13px;
  cursor: pointer; background: #eef1f5; color: var(--text); transition: .15s;
  font-family: inherit; white-space: nowrap;
}
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); filter: none; }
.btn-ghost { background: #fff; border-color: var(--line); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; padding: 11px; font-size: 14px; }
.btn-danger { background: var(--danger-l); color: var(--danger); border-color: #f3d3d3; }
.btn-ok { background: var(--ok-l); color: var(--ok); border-color: #cbe8d8; }
.btn-warn { background: var(--warn-l); color: var(--warn); border-color: #f2ddb6; }

input[type=text], input[type=password], input[type=search], select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px;
  outline: none; background: #fff; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 116, 144, .1); }
textarea { resize: vertical; min-height: 62px; width: 100%; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
}
.card-head h3 { margin: 0; font-size: 14.5px; }
.card-body { padding: 16px 18px; }

/* 工具条 */
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search] { width: 230px; }
.toolbar .grow { flex: 1; }

/* 日期筛选行（首访日期 / 最近回访日期） */
.toolbar.filter-dates { gap: 7px; margin-top: -6px; }
.toolbar.filter-dates input[type=date] { width: 140px; }
.fd-label { font-size: 12.5px; color: var(--muted); }
.fd-sep { width: 1px; height: 18px; background: var(--line); margin: 0 5px; }

/* 统计 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .lbl { font-size: 12.5px; color: var(--muted); }
.stat .num { font-size: 26px; font-weight: 700; margin-top: 6px; color: var(--brand); letter-spacing: .5px; }
.stat.warn .num { color: var(--warn); }
.stat.ok .num { color: var(--ok); }
.stat.plain .num { color: var(--text); }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 10px 12px; background: #f8fafc; color: var(--muted);
  font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tbody tr:hover { background: #fafcfd; }
table.tbl td.nowrap, table.tbl th.nowrap { white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }
.empty { text-align: center; padding: 44px 12px; color: #9aa4b2; font-size: 13px; }
.empty .big { font-size: 30px; display: block; margin-bottom: 8px; }

/* 标签 */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px;
  background: #eef1f5; color: var(--muted); white-space: nowrap;
}
.tag.ok { background: var(--ok-l); color: var(--ok); }
.tag.warn { background: var(--warn-l); color: var(--warn); }
.tag.plain { background: #eef1f5; color: #7a8698; }
.tag.brand { background: var(--brand-l); color: var(--brand); }

/* 通话轮次标签：第1通=首访（灰），第2通起=回访（橙，醒目） */
.round-tag {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 11.5px; white-space: nowrap;
  background: #eef1f5; color: #7a8698;
}
.round-tag.first { background: #eef1f5; color: #67748a; }
.round-tag.revisit { background: var(--warn-l); color: var(--warn); font-weight: 600; }
.round-tag.latest { background: var(--brand-l); color: var(--brand); font-weight: 600; }
.stat.revisit .num { color: var(--warn); }
.revisit-mini { color: var(--warn); }

/* 客户详情 · 通话时间线 */
.timeline { padding: 2px 0; }
.tl-item { display: flex; gap: 12px; padding: 10px 0; }
.tl-item + .tl-item { border-top: 1px dashed #e6ebf2; }
.tl-dot {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; background: #eef1f5; color: #67748a;
}
.tl-revisit .tl-dot { background: var(--warn-l); color: var(--warn); font-weight: 700; }
.tl-body { flex: 1 1 auto; min-width: 0; }
/* 最近一次通话（最近回访）高亮 */
.tl-latest { background: #f5f9ff; border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.tl-latest .tl-dot { box-shadow: 0 0 0 3px rgba(14, 116, 144, .18); }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-head .grow { flex: 1 1 auto; }
.tl-file { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 扫描目录设置弹窗 */
.sd-list { border: 1px solid #e6ebf2; border-radius: 8px; overflow: hidden; }
.sd-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.sd-row + .sd-row { border-top: 1px solid #e6ebf2; }
.sd-row .grow { flex: 1 1 auto; }
.sd-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-browser { margin-top: 10px; border: 1px solid #e6ebf2; border-radius: 8px; padding: 10px; background: #fafbfc; }
.sd-crumb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.sd-crumb .grow { flex: 1 1 auto; }
.sd-dirs { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow: auto; }
.sd-dir {
  border: 1px solid #dfe5ec; background: #fff; border-radius: 6px;
  padding: 4px 10px; font-size: 12.5px; cursor: pointer;
}
.sd-dir:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-l); }
.sd-manual { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.sd-manual input { flex: 1 1 auto; }
.mono { font-family: Consolas, "Courier New", monospace; letter-spacing: .2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 18px; }
.pager .info { font-size: 12.5px; color: var(--muted); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 34, 49, .45); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 520px;
  max-height: 88vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
}
.modal.wide { max-width: 760px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; }
.hr { border: none; border-top: 1px solid var(--line-2); margin: 14px 0; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; }
.field .hint { font-size: 11.5px; color: #9aa4b2; margin-top: 4px; }

/* 播放条 */
.player-bar {
  position: fixed; left: 208px; right: 0; bottom: 0; z-index: 150;
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -4px 18px rgba(16, 24, 40, .08);
  display: flex; align-items: center; gap: 16px; padding: 10px 24px;
}
.pb-info { min-width: 0; flex: 0 0 260px; display: flex; flex-direction: column; }
.pb-info b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-info span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bar audio { flex: 1; height: 34px; }

/* Toast */
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 400; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 6px 22px rgba(0, 0, 0, .2); animation: slidein .2s ease;
  max-width: 380px;
}
.toast.ok { background: #0f7a4a; }
.toast.error { background: #b93b3b; }
@keyframes slidein { from { transform: translateX(18px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 批量上传 */
.upload-mask {
  position: fixed; inset: 0; background: rgba(15, 34, 49, .5); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.upload-card {
  background: #fff; border-radius: 12px; width: 100%; max-width: 430px;
  padding: 22px 24px 18px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.upload-card h3 { margin: 0 0 6px; font-size: 15px; }
.upload-card .up-tip { margin: 0 0 14px; font-size: 12px; color: var(--muted); }
.up-file {
  font-size: 12.5px; color: var(--muted); margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 19px;
}
.up-bar { height: 8px; background: #eef1f5; border-radius: 6px; overflow: hidden; }
.up-bar > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .15s; }
.up-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.up-actions { display: flex; justify-content: flex-end; margin-top: 14px; }

/* 转写文字 */
.tx-meta {
  display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted);
  padding-bottom: 12px; border-bottom: 1px dashed var(--line); margin-bottom: 12px;
}
.tx-meta .warn-text { color: var(--warn); }
.tx-box {
  white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.85;
  max-height: 52vh; overflow: auto; background: #fbfcfe; border: 1px solid var(--line);
  border-radius: 8px; padding: 14px 16px;
}
.tx-edit { min-height: 48vh; font-size: 13.5px; line-height: 1.75; }
.lk-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--line-2);
}
.lk-row:last-child { border-bottom: 0; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .player-bar { left: 0; }
  .grid2 { grid-template-columns: 1fr; }
}
