/* 德恒口腔 · 线索派单 CRM —— 前端样式 */
:root {
  --brand: #0f766e;
  --brand-d: #0b5d57;
  --brand-l: #14b8a6;
  --bg: #f5f7f8;
  --card: #ffffff;
  --line: #e3e8eb;
  --t1: #1a2328;
  --t2: #4a5a62;
  --t3: #8b9aa2;
  --red: #dc2626;
  --amber: #d97706;
  --blue: #2563eb;
  --purple: #7c3aed;
  --green: #059669;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 32, .06), 0 4px 12px rgba(16, 24, 32, .04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 14px/1.6 "Microsoft YaHei", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--t1); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #0b3d3a 0%, #0f766e 45%, #14b8a6 100%); padding: 20px; }
.login-box { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 34px 30px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .n { font-size: 21px; font-weight: 700; letter-spacing: .5px; }
.login-logo .s { font-size: 12px; color: var(--t3); margin-top: 5px; letter-spacing: 2px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--t2); margin-bottom: 6px; }
.inp, .sel, textarea.inp {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.inp { height: auto; min-height: 70px; padding: 9px 12px; line-height: 1.6; resize: vertical; }
.inp:focus, .sel:focus, textarea.inp:focus { border-color: var(--brand-l); box-shadow: 0 0 0 3px rgba(20,184,166,.12); }
.btn {
  height: 40px; padding: 0 18px; border: 0; border-radius: 8px; background: var(--brand); color: #fff;
  cursor: pointer; font-weight: 600; transition: background .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--brand-d); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
.btn-ghost { background: #fff; color: var(--t2); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f0f4f5; color: var(--t1); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; }
.login-tip { margin-top: 14px; font-size: 12px; color: var(--t3); text-align: center; line-height: 1.8; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 186px; flex: 0 0 186px; background: #0d2b29; color: #cfdedd; padding: 16px 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sb-brand { padding: 0 16px 16px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 10px; }
.sb-brand b { color: #fff; font-size: 15px; display: block; }
.sb-brand span { font-size: 11px; color: #7fa8a4; letter-spacing: 1.5px; }
.nav { flex: 1; }
.nav-group { padding: 12px 16px 5px; font-size: 11px; color: #6d918e; letter-spacing: 1px; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 9px 16px; color: #cfdedd; font-size: 13.5px;
  border-left: 3px solid transparent; cursor: pointer; transition: background .12s;
}
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a.on { background: rgba(20,184,166,.16); border-left-color: var(--brand-l); color: #fff; font-weight: 600; }
.nav a .ico { width: 16px; text-align: center; opacity: .85; }
.nav a .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 10.5px;
  padding: 1px 6px; border-radius: 9px; font-weight: 700; }
.sb-foot { padding: 12px 16px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #7fa8a4; }
.sb-foot .who { color: #fff; font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 54px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 14px; padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.sync { font-size: 12px; color: var(--t3); display: flex; align-items: center; gap: 6px; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.content { padding: 18px 20px 40px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 14px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card-h h3 { font-size: 14.5px; font-weight: 700; }
.card-h .sub { font-size: 12px; color: var(--t3); }
.card-b { padding: 16px; }
.card-b.tight { padding: 10px; }

/* ---------- 指标 ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k { font-size: 12px; color: var(--t3); margin-bottom: 6px; }
.kpi .v { font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: -.5px; }
.kpi .v.red { color: var(--red); }
.kpi .v.amber { color: var(--amber); }
.kpi .v.green { color: var(--green); }
.kpi .s { font-size: 11.5px; color: var(--t3); margin-top: 3px; }

/* ---------- 表格 ---------- */
.tw { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
  text-align: left; padding: 9px 10px; background: #f8fafb; border-bottom: 1px solid var(--line);
  font-weight: 600; color: var(--t2); font-size: 12px; white-space: nowrap; position: sticky; top: 0;
}
table.tb td { padding: 9px 10px; border-bottom: 1px solid #f0f3f4; vertical-align: middle; }
table.tb tr:hover td { background: #fafcfc; }
table.tb tr.sel td { background: #effbf9; }
table.tb td.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--t2); }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 1.5px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.tag.ok { background: rgba(5,150,105,.1); color: var(--green); }
.tag.warn { background: rgba(217,119,6,.1); color: var(--amber); }
.tag.blue { background: rgba(37,99,235,.1); color: var(--blue); }
.tag.purple { background: rgba(124,58,237,.1); color: var(--purple); }
.tag.gray { background: #f0f3f4; color: var(--t3); }
.tag.red { background: rgba(220,38,38,.1); color: var(--red); }
.tag.brand { background: rgba(15,118,110,.1); color: var(--brand); }

/* ---------- 空态 ---------- */
.empty { padding: 44px 20px; text-align: center; color: var(--t3); font-size: 13px; }
.empty .big { font-size: 26px; margin-bottom: 8px; opacity: .35; }

/* ---------- Toast / 弹窗 ---------- */
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1a2328; color: #fff; padding: 9px 18px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: tin .2s ease-out; max-width: 78vw; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.mask { position: fixed; inset: 0; background: rgba(10,20,24,.45); z-index: 900; display: flex;
  align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 24px 70px rgba(0,0,0,.3);
  animation: min .18s ease-out; }
@keyframes min { from { opacity: 0; transform: translateY(-10px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-h h3 { font-size: 15px; font-weight: 700; flex: 1; }
.modal-h .x { cursor: pointer; color: var(--t3); font-size: 20px; line-height: 1; padding: 0 4px; }
.modal-b { padding: 18px 20px; max-height: 66vh; overflow-y: auto; }
.modal-f { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; }

/* ---------- 表单行 ---------- */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hint { font-size: 11.5px; color: var(--t3); line-height: 1.7; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- 分配台 ---------- */
.agent-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid #f0f3f4; }
.agent-row:last-child { border-bottom: 0; }
.agent-row .nm { width: 70px; font-weight: 600; }
.agent-row .bar { flex: 1; height: 8px; background: #eef2f3; border-radius: 5px; overflow: hidden; }
.agent-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-l), var(--brand)); }
.agent-row .n { width: 104px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.agent-row .od { width: 62px; text-align: right; }

/* ---------- 员工卡片 ---------- */
.mine-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.lcard { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 9px;
  padding: 13px 14px; box-shadow: var(--shadow); }
.lcard.od { border-left-color: var(--red); }
.lcard.done { border-left-color: var(--t3); opacity: .92; }
.lcard .top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.lcard .top b { font-size: 14.5px; }
.lcard .top .t { margin-left: auto; font-size: 11.5px; }
.lcard .meta { font-size: 12px; color: var(--t2); line-height: 1.9; }
.lcard .acts { margin-top: 10px; display: flex; gap: 7px; flex-wrap: wrap; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; font-size: 12.5px; color: var(--t2); }
.pager .sp { flex: 1; }

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row;
    overflow-x: auto; padding: 8px; gap: 4px; }
  .sb-brand, .sb-foot, .nav-group { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 11px; font-size: 12.5px; }
  .nav a.on { border-left: 0; border-bottom-color: var(--brand-l); }
  .nav a .ico { display: none; }
  .content { padding: 12px 12px 30px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 12px; }
  .topbar h2 { font-size: 14.5px; }
  .sync span { display: none; }
}
