:root {
  --el-color-primary: #2563eb;
  --el-color-primary-light-3: #5b8af0;
  --el-color-primary-light-5: #92b1f5;
  --el-color-primary-light-7: #c8d8fa;
  --el-color-primary-light-8: #dbe6fb;
  --el-color-primary-light-9: #edf2fd;
  --el-color-primary-dark-2: #1d4fbc;
  --app-bg: #f4f6fb;
  --app-aside: #0f1b33;
  --app-aside-hover: #1a2a4a;
  --app-border: #e6e9f0;
  --app-muted: #6b7280;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--app-bg);
  color: #1f2937;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--el-color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.layout { height: 100%; }
.aside {
  background: var(--app-aside);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  transition: width .2s;
  overflow: hidden;
}
.brand {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb 60%, #1e40af);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .35);
}
.aside-mobile { position: fixed; left: 0; top: 0; bottom: 0; z-index: 2001; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
.aside-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 2000; }
.aside .el-menu { border-right: none; background: transparent; flex: 1; overflow-y: auto; }
.aside .el-menu-item, .aside .el-sub-menu__title { color: #cbd5e1; height: 46px; line-height: 46px; }
.aside .el-menu-item:hover, .aside .el-sub-menu__title:hover { background: var(--app-aside-hover) !important; color: #fff; }
.aside .el-menu-item.is-active { background: #2563eb !important; color: #fff; border-radius: 0; }
.aside .el-sub-menu .el-menu { background: #0b1528; }
.aside .el-menu--collapse { width: 64px; }
.header {
  background: #fff;
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 20px;
  gap: 12px;
}
.header-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.header-right { display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; color: #374151; }
.main { padding: 20px; overflow-y: auto; }

/* ---------- 通用 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head .sub { color: var(--app-muted); font-size: 13px; margin-top: 4px; }
.card { background: #fff; border: 1px solid var(--app-border); border-radius: 10px; padding: 18px; }
.card + .card { margin-top: 16px; }
.card-title { font-weight: 600; font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--app-muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mb12 { margin-bottom: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.el-tag + .el-tag { margin-left: 4px; }
.table-wrap { overflow-x: auto; }

/* ---------- 登录 ---------- */
.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, #dbe6fb 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #e0e7ff 0%, transparent 60%),
    var(--app-bg);
}
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 32px 30px 26px; box-shadow: 0 20px 50px rgba(15, 27, 51, .08); border: 1px solid var(--app-border); }
.login-brand { text-align: center; margin-bottom: 14px; }
.login-brand .logo-mark { width: 48px; height: 48px; margin: 0 auto 12px; font-size: 18px; border-radius: 12px; }
.login-brand h1 { font-size: 22px; margin: 0 0 6px; }
.login-brand p { color: var(--app-muted); font-size: 13px; margin: 0; line-height: 1.6; }

/* ---------- 仪表盘 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--app-border); border-radius: 10px; padding: 16px 18px; }
.stat .label { color: var(--app-muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--app-muted); margin-top: 2px; }
.steps { display: grid; gap: 10px; }
.step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px dashed var(--app-border); border-radius: 8px; }
.step.done { border-style: solid; background: #f6fbf7; border-color: #cdebd4; }
.step .num { width: 26px; height: 26px; border-radius: 50%; background: #eef2ff; color: #2563eb; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.step.done .num { background: #22c55e; color: #fff; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.bar-row .name { width: 70px; flex: none; }
.bar-row .bar { flex: 1; height: 10px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.bar-row .bar > div { height: 100%; border-radius: 6px; }
.bar-row .num { width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 搜索任务 ---------- */
.log-box { background: #0f172a; color: #cbd5e1; border-radius: 8px; padding: 12px 14px; font-size: 12.5px; line-height: 1.7; max-height: 360px; overflow-y: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.log-box .warn { color: #fbbf24; }
.log-box .error { color: #f87171; }
.log-box .success { color: #4ade80; }
.log-box .ts { color: #64748b; margin-right: 8px; }
.task-item { padding: 12px 14px; border: 1px solid var(--app-border); border-radius: 8px; cursor: pointer; margin-bottom: 8px; transition: border-color .15s, background .15s; }
.task-item:hover { border-color: #93c5fd; }
.task-item.active { border-color: #2563eb; background: #f5f8ff; }

/* ---------- 客户库 ---------- */
.score-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.grade { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: 12px; font-weight: 700; color: #fff; }
.grade-A { background: #16a34a; } .grade-B { background: #2563eb; } .grade-C { background: #f59e0b; } .grade-D { background: #9ca3af; }
.company-cell .name { font-weight: 600; color: #111827; cursor: pointer; }
.company-cell .name:hover { color: var(--el-color-primary); }
.score-row { display: grid; grid-template-columns: 90px 1fr 54px; gap: 10px; align-items: center; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #eef0f4; }
.score-row .note { grid-column: 2 / 4; color: var(--app-muted); font-size: 12px; margin-top: -4px; }
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 6px 10px; font-size: 13.5px; }
.kv .k { color: var(--app-muted); }
.contact-card { border: 1px solid var(--app-border); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; font-size: 13px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }

/* ---------- 邮件 ---------- */
.mail-layout { display: grid; grid-template-columns: 220px minmax(280px, 380px) 1fr; gap: 14px; height: calc(100vh - 140px); min-height: 520px; }
.mail-col { background: #fff; border: 1px solid var(--app-border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.mail-col .col-head { padding: 12px 14px; border-bottom: 1px solid var(--app-border); }
.mail-col .col-body { flex: 1; overflow-y: auto; min-height: 0; }
.folder { padding: 9px 14px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.folder:hover { background: #f5f7fb; }
.folder.active { background: #edf2fd; color: #2563eb; font-weight: 600; }
.acc-name { padding: 10px 14px 4px; font-size: 12px; color: var(--app-muted); }
.msg-item { padding: 11px 14px; border-bottom: 1px solid #f0f2f6; cursor: pointer; }
.msg-item:hover { background: #f8fafc; }
.msg-item.active { background: #edf2fd; }
.msg-item.unread .subj { font-weight: 700; }
.msg-item .from { font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.msg-item .subj { font-size: 14px; margin: 3px 0; }
.msg-item .prev { font-size: 12px; color: var(--app-muted); }
.mail-view { padding: 18px 20px; }
.mail-view h3 { margin: 0 0 10px; font-size: 18px; }
.mail-body { margin-top: 14px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.mail-html { width: 100%; min-height: 420px; border: 1px solid var(--app-border); border-radius: 8px; margin-top: 12px; background: #fff; }
.kb-ref { background: #f8fafc; border: 1px solid var(--app-border); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; margin-bottom: 6px; }

/* ---------- 后台 ---------- */
.provider-group { margin-bottom: 22px; }
.provider-group-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; margin-bottom: 10px; border-bottom: 2px solid var(--el-color-primary-light-7); }
.provider-group-empty { padding: 6px 2px 10px; }
.provider-card { background: #fff; border: 1px solid var(--app-border); border-radius: 10px; margin-bottom: 14px; }
.provider-card .p-head { padding: 14px 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--app-border); }
.provider-card .p-name { font-weight: 600; font-size: 15px; }
.provider-card .p-desc { font-size: 12.5px; color: var(--app-muted); margin-top: 4px; }
.provider-card .p-body { padding: 6px 18px 14px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tpl-card { background: #fff; border: 1px solid var(--app-border); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.tpl-card .tpl-body { font-size: 13px; color: #4b5563; white-space: pre-wrap; max-height: 140px; overflow: hidden; mask-image: linear-gradient(#000 70%, transparent); }
.guide ol { padding-left: 20px; line-height: 1.9; margin: 6px 0; }
.guide code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

@media (max-width: 1100px) {
  .mail-layout { grid-template-columns: 1fr; height: auto; }
  .mail-col { max-height: 70vh; }
}
@media (max-width: 768px) {
  .main { padding: 14px 16px; }
  .header { padding: 0 12px; }
  .hide-mobile { display: none !important; }
  .score-row { grid-template-columns: 76px 1fr 46px; }
}
.kv .mono { word-break: break-all; }
.el-dialog { max-width: calc(100vw - 16px); }

/* ---------- 报价与单据 ---------- */
.mt4 { margin-top: 4px; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; } .center { text-align: center; }
.clickable { cursor: pointer; }
.local-time { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: #f1f5f9; flex-wrap: wrap; }
.local-time.lt-large { font-size: 14px; padding: 8px 12px; border-radius: 10px; }
.local-time .dot, .clock .dot, .legend { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #94a3b8; flex: none; }
.lt-work .dot, .legend.lt-work { background: #22c55e; }
.lt-edge .dot, .legend.lt-edge { background: #f59e0b; }
.lt-rest .dot, .legend.lt-rest { background: #94a3b8; }
.local-time.lt-work { background: #ecfdf5; } .local-time.lt-edge { background: #fffbeb; }
.legend { margin: 0 3px 0 8px; }
.clock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.clock { border: 1px solid var(--app-border); border-radius: 10px; padding: 8px 10px; background: #fafbfc; }
.clock.lt-work { border-color: #bbf7d0; background: #f0fdf4; }
.clock.lt-edge { border-color: #fde68a; background: #fffbeb; }
.clock-city { font-size: 12px; color: var(--app-muted); }
.clock-time { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.3; }
.clock-meta { font-size: 11px; display: flex; align-items: center; gap: 4px; }
.clock-del { cursor: pointer; color: #ef4444; }
.fx-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fx-result { font-size: 22px; font-weight: 600; margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.fx-table { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fx-cell { background: #f8fafc; border-radius: 6px; padding: 4px 6px; font-size: 12px; display: flex; flex-direction: column; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px dashed #eef0f4; cursor: pointer; }
.doc-row:hover { background: #f8fafc; }
.attach-chip { display: inline-flex; align-items: center; gap: 4px; background: #f1f5f9; border: 1px solid var(--app-border); border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.attach-chip .chip-x { cursor: pointer; color: #94a3b8; margin-left: 2px; }
.attach-chip .chip-x:hover { color: #ef4444; }
a.attach-chip, .attach-chip.clickable { cursor: pointer; color: inherit; text-decoration: none; }
.attach-chip.clickable:hover { border-color: var(--el-color-primary); color: var(--el-color-primary); }
.zh-text { background: #f0fdf4; border-radius: 4px; }
.zh-banner { font-size: 12px; color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; padding: 6px 10px; }
.zh-subject { font-weight: 600; margin-top: 10px; }
.smart-target { background: #f8fafc; border: 1px solid var(--app-border); border-radius: 8px; padding: 10px 12px; display: grid; gap: 4px; }
.doc-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; position: sticky; top: -20px; z-index: 5; }
.ai-card { background: linear-gradient(135deg, #eff6ff, #faf5ff); border-color: #c7d2fe; }
.ai-warn { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: #b45309; padding: 2px 0; }
.ai-warn .el-icon { margin-top: 2px; flex: none; }
.ai-list { margin: 4px 0 0; padding-left: 18px; }
.items-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.items-table th { background: #f8fafc; font-weight: 600; font-size: 12px; color: #475569; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--app-border); }
.items-table td { padding: 8px 6px; border-bottom: 1px solid #f0f2f6; vertical-align: top; }
.items-table td.num { text-align: right; font-variant-numeric: tabular-nums; padding-top: 14px; font-weight: 500; }
.items-table td.idx { color: var(--app-muted); padding-top: 14px; text-align: center; }
.items-table .row-move { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 6px; color: #94a3b8; cursor: pointer; }
.items-table .row-move .el-icon:hover { color: var(--el-color-primary); }
.items-table td.desc { min-width: 260px; }
.items-table .empty-row { text-align: center; padding: 24px; }
.item-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--app-border); flex: none; }
.below-ref { color: #dc2626; }
.totals { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--app-border); }
.fee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; flex: 1; min-width: 280px; }
.fee-grid > div { display: flex; flex-direction: column; gap: 4px; }
.fee-grid .el-input-number { width: 100%; }
.totals-sum { text-align: right; margin-left: auto; }
.totals-sum .grand { font-size: 22px; font-weight: 700; color: #1f4e79; font-variant-numeric: tabular-nums; }
.side-sticky { position: sticky; top: 60px; }
.side-total { font-size: 24px; font-weight: 700; color: #1f4e79; font-variant-numeric: tabular-nums; }
.product-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--app-border); }
.product-thumb.empty { display: grid; place-items: center; color: #cbd5e1; background: #f8fafc; }
.image-uploader .el-upload { border: 1px dashed #cbd5e1; border-radius: 10px; width: 150px; height: 150px; display: grid; place-items: center; overflow: hidden; cursor: pointer; background: #fafbfc; }
.image-uploader .el-upload:hover { border-color: var(--el-color-primary); }
.image-uploader .uploaded { width: 100%; height: 100%; object-fit: cover; }
.upload-ph { color: #94a3b8; text-align: center; }
@media (max-width: 1199px) { .side-sticky { position: static; } }
@media (max-width: 767px) { .doc-toolbar { position: static; } .clock-time { font-size: 18px; } }
