/* style.css — LabStone 外贸 CRM，简洁服务端渲染风格 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 14px; color: #2b2f36; background: #f4f6f9; line-height: 1.6;
}
a { color: #2f6fd0; text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶部导航 */
.topnav {
  background: #243447; color: #cfd8e3; padding: 0 24px; height: 46px;
  display: flex; align-items: center; gap: 20px;
}
.topnav a { color: #cfd8e3; }
.topnav a:hover { color: #fff; text-decoration: none; }
.topnav .brand { font-weight: 700; color: #fff; margin-right: 12px; }
.topnav .nav-right { margin-left: auto; font-size: 13px; }

/* 布局：顶栏 + 左侧菜单 + 主内容 */
.layout { display: flex; min-height: calc(100vh - 46px); align-items: stretch; }
.sidenav {
  width: 176px; flex-shrink: 0; background: #fff; border-right: 1px solid #e3e8ef;
  padding: 14px 10px; display: flex; flex-direction: column; gap: 2px;
}
.side-title { font-size: 12px; color: #8a94a3; padding: 4px 12px 8px; font-weight: 600; letter-spacing: 2px; }
.side-link {
  display: block; padding: 9px 14px; border-radius: 6px; color: #3d4a5c;
  font-size: 14px; text-decoration: none;
}
.side-link:hover { background: #f0f4fa; color: #2f6fd0; text-decoration: none; }
.side-link.active { background: #2f6fd0; color: #fff; font-weight: 600; }
/* 折叠分组（客户管理） */
details.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group summary {
  display: block; padding: 9px 14px; border-radius: 6px; color: #3d4a5c;
  font-size: 14px; font-weight: 600; cursor: pointer; user-select: none; list-style: none;
}
.side-group summary::-webkit-details-marker { display: none; }
.side-group summary::before { content: "▸"; display: inline-block; margin-right: 8px; color: #8a94a3; font-size: 12px; transition: transform .15s; }
.side-group[open] summary::before { transform: rotate(90deg); }
.side-group summary:hover { background: #f0f4fa; color: #2f6fd0; }
.side-link.sub { padding-left: 34px; font-size: 13px; }
@media (max-width: 700px) {
  .layout { flex-direction: column; }
  .sidenav { width: 100%; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid #e3e8ef; }
  .side-title { display: none; }
}

.container { flex: 1; max-width: 1200px; margin: 0 auto; padding: 24px 20px; min-width: 0; }
h2 { margin: 8px 0 16px; }
h3 { margin: 22px 0 10px; }
.muted { color: #8a94a3; font-size: 13px; }
.text-danger { color: #d64541; }
.breadcrumb { margin-bottom: 8px; font-size: 13px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card {
  background: #fff; border-radius: 8px; padding: 14px 16px; text-align: center;
  border: 1px solid #e3e8ef; color: #2b2f36;
}
.stat-card b { display: block; font-size: 24px; color: #243447; }
.stat-card span { font-size: 12px; color: #8a94a3; }
.stat-card.stat-warn b { color: #e67e22; }
.stat-card.stat-danger b { color: #d64541; }
.stat-card:hover { border-color: #2f6fd0; text-decoration: none; }

/* 工具栏 & 按钮 */
.toolbar { margin: 14px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 6px 14px; border: 1px solid #ccd4de; border-radius: 6px;
  background: #fff; color: #2b2f36; font-size: 13px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #2f6fd0; color: #2f6fd0; text-decoration: none; }
.btn-primary { background: #2f6fd0; border-color: #2f6fd0; color: #fff; }
.btn-primary:hover { background: #255aa8; color: #fff; }
.btn-danger { color: #d64541; border-color: #e3b8b6; }
.btn-danger:hover { background: #d64541; color: #fff; border-color: #d64541; }
.btn-sm { padding: 2px 8px; font-size: 12px; }
.btn-block { width: 100%; }
.inline-form { display: inline; }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.tbl th, .tbl td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #edf0f4; font-size: 13px; }
.tbl th { background: #f8fafc; color: #5b6675; font-weight: 600; white-space: nowrap; }
.tbl tr:hover td { background: #f6f9fd; }
.row-overdue td { background: #fdf1f0 !important; }

/* 筛选栏 */
.filter-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select {
  padding: 7px 10px; border: 1px solid #ccd4de; border-radius: 6px; font-size: 13px; background: #fff;
}
.input-grow { flex: 1; min-width: 220px; }

/* 表单 */
.form-card { background: #fff; border: 1px solid #e3e8ef; border-radius: 8px; padding: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: #5b6675; font-weight: 600; }
.field input, .field select, .field textarea, .contact-form input, .contact-form select, .contact-form textarea {
  padding: 7px 10px; border: 1px solid #ccd4de; border-radius: 6px; font-size: 13px;
  font-family: inherit; width: 100%;
}
.field textarea, .contact-form textarea { resize: vertical; }

/* 徽章 */
.badge { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; background: #eef1f5; color: #5b6675; }
.badge-intent-a { background: #fde8e8; color: #c0392b; font-weight: 600; }
.badge-intent-b { background: #fef3e2; color: #b9770e; }
.badge-intent-c { background: #eef1f5; color: #5b6675; }
.badge-stage-new { background: #e8f1fd; color: #2471a3; }
.badge-stage-quoted { background: #f4ecfd; color: #7d3c98; }
.badge-stage-nego { background: #fef9e7; color: #b7950b; }
.badge-stage-won { background: #e9f9ef; color: #1e8449; font-weight: 600; }
.badge-stage-lost { background: #f2f3f5; color: #909497; }
.badge-pending { background: #fff3cd; color: #856404; }

/* 详情页 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }
.card { background: #fff; border: 1px solid #e3e8ef; border-radius: 8px; padding: 18px; }
.kv { width: 100%; border-collapse: collapse; }
.kv th, .kv td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #f0f2f5; font-size: 13px; vertical-align: top; }
.kv th { color: #5b6675; width: 90px; font-weight: 600; white-space: nowrap; }

/* 时间线 */
.timeline { position: relative; padding-left: 22px; }
.tl-item { position: relative; padding-bottom: 18px; border-left: 2px solid #dfe5ec; padding-left: 18px; margin-left: 4px; }
.tl-item:last-child { border-left-color: transparent; }
.tl-dot {
  position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: #2f6fd0; border: 2px solid #fff; box-shadow: 0 0 0 1px #ccd4de;
}
.tl-dot-ai { background: #e67e22; }
.tl-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.tl-summary { white-space: pre-wrap; }
.tl-plan { margin-top: 4px; font-size: 13px; color: #1e8449; background: #f0faf4; padding: 4px 8px; border-radius: 4px; }

/* 提醒条 */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash-ok { background: #e9f9ef; color: #1e8449; border: 1px solid #bfe8cf; }
.flash-err { background: #fdecea; color: #c0392b; border: 1px solid #f2c3bf; }
.alert-warn {
  background: #fff8e6; border: 1px solid #f0dfa8; color: #856404;
  padding: 10px 14px; border-radius: 6px; margin-bottom: 14px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}

/* 分页 */
.pagination { display: flex; gap: 10px; align-items: center; margin: 16px 0; }

/* 系统维护 */
.pw-input { padding: 4px 8px; border: 1px solid #ccd4de; border-radius: 6px; width: 140px; font-size: 13px; }
.pw-input:focus { outline: none; border-color: #2f6fd0; }

/* 导航搜索框 */
.nav-search { display: flex; }
.nav-search input {
  padding: 5px 10px; border: none; border-radius: 12px; font-size: 13px;
  width: 200px; background: #3b4d63; color: #e8eef5; outline: none;
}
.nav-search input::placeholder { color: #9fb0c2; }

/* 文本警示色（逾期/超期未联系） */
.text-warn { color: #e67e22; }

/* 客户分类徽章 */
.badge-cat-dealer { background: #e8f1fd; color: #2471a3; }
.badge-cat-end    { background: #e9f9ef; color: #1e8449; }
.badge-cat-lab    { background: #f4ecfd; color: #7d3c98; }
.badge-cat-trade  { background: #fef9e7; color: #b7950b; }
.badge-cat-peer   { background: #f2f3f5; color: #909497; }
.btn-warn { background: #e67e22; border-color: #e67e22; color: #fff; }
.btn-warn:hover { background: #cf6a15; color: #fff; }

/* 登录页 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #243447; }
.login-box { background: #fff; padding: 34px 36px; border-radius: 10px; width: 340px; }
.login-box h1 { font-size: 19px; text-align: center; margin-bottom: 22px; color: #243447; }
.login-box label { display: block; font-size: 13px; color: #5b6675; margin: 10px 0 4px; }
.login-box input { width: 100%; padding: 9px 10px; border: 1px solid #ccd4de; border-radius: 6px; font-size: 14px; }
.login-box .btn { margin-top: 18px; padding: 10px; font-size: 15px; }
