* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f6f8; --card: #fff; --line: #e5e7eb;
  --text: #1f2937; --muted: #6b7280;
  --blue: #185FA5; --blue-bg: #E6F1FB;
  --green: #0F6E56; --green-bg: #E1F5EE;
  --amber: #854F0B; --amber-bg: #FAEEDA;
  --red: #A32D2D; --red-bg: #FCEBEB;
}
body { font-family: "Segoe UI", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
textarea { resize: vertical; }

/* 登录 */
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 40px; width: 360px; }
.login-card h1 { font-size: 20px; margin-bottom: 6px; }
.login-card p { color: var(--muted); margin-bottom: 24px; }
.login-card input { width: 100%; margin-bottom: 12px; }
.login-card button { width: 100%; }

/* 布局 */
.layout { display: flex; height: 100vh; }
.sidebar { width: 190px; background: #12314f; color: #cfe0f0; display: flex; flex-direction: column; padding: 18px 0; flex-shrink: 0; }
.sidebar .logo { padding: 0 20px 18px; font-size: 16px; font-weight: 600; color: #fff; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 10px; }
.sidebar .nav-item { padding: 11px 20px; cursor: pointer; color: #cfe0f0; }
.sidebar .nav-item:hover { background: rgba(255,255,255,.08); }
.sidebar .nav-item.active { background: var(--blue); color: #fff; }
.sidebar .spacer { flex: 1; }
.sidebar .user-info { padding: 12px 20px; font-size: 12px; color: #9fb8cf; border-top: 1px solid rgba(255,255,255,.12); }
.main { flex: 1; overflow-y: auto; padding: 24px; }

/* 通用 */
.btn { background: var(--blue); color: #fff; border: none; border-radius: 8px; padding: 8px 16px; }
.btn:hover { filter: brightness(1.08); }
.btn.gray { background: #eef0f3; color: var(--text); border: 1px solid var(--line); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: var(--blue-bg); color: var(--blue); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.amber { background: var(--amber-bg); color: var(--amber); }
.tag.red { background: var(--red-bg); color: var(--red); }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat .num { font-size: 26px; font-weight: 600; }
.stat .lbl { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 500; background: #fafbfc; }
tbody tr:hover { background: #f6f9fd; cursor: pointer; }

/* 客户详情弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--card); border-radius: 16px; width: min(920px, 94vw); max-height: 92vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; }
.section-title { font-size: 13px; font-weight: 600; color: var(--blue); margin: 16px 0 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

/* 时间线 */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding: 8px 0 14px; }
.tl-item::before { content: ""; position: absolute; left: -17px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.tl-meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.tl-body { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; }

/* 邮件 */
.mail-item { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.mail-item:hover { background: #f6f9fd; }
.mail-item.unread { background: var(--blue-bg); }
.mail-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex-shrink: 0; }
.mail-item.read .dot { background: transparent; }
.mail-body { white-space: pre-wrap; word-break: break-word; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 14px; line-height: 1.7; }
.badge { background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; margin-left: 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #12314f; color: #fff; padding: 10px 20px; border-radius: 10px; z-index: 99; font-size: 13px; }
.hidden { display: none !important; }
