/* ========== ERP 客户报价系统 全局样式 ========== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --info: #0891b2;
  --info-light: #ecfeff;
  --text: #1f2937;
  --text-2: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body, #root { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 3px 10px; font-size: 13px; }
.btn-lg { padding: 10px 28px; font-size: 15px; }
.btn-block { width: 100%; padding: 10px 16px; font-size: 15px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-primary-outline { background: #fff; border-color: var(--primary); color: var(--primary); }
.btn-primary-outline:hover { background: var(--primary-light); color: var(--primary-dark); }
.btn-danger { background: #fff; border-color: #fca5a5; color: var(--danger); }
.btn-danger:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }

/* ========== 表单 ========== */
.input {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.input.num { text-align: right; }
.textarea { resize: vertical; min-height: 60px; }
.search-input { max-width: 280px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.form-item-full { grid-column: 1 / -1; }
.form-item label { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 13px; }
.form-item .required { color: var(--danger); margin-right: 2px; }
.checkbox-line { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; cursor: pointer; padding-top: 8px; }
.mt-12 { margin-top: 12px; }
.ml-8 { margin-left: 8px; }

/* ========== 卡片 / 表格 ========== */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 16px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title { margin-bottom: 12px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.table th { background: #f9fafb; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.table tbody tr:hover { background: #f8fafc; }
.table .num { text-align: right; }
.table .strong { font-weight: 600; }
.table .empty { text-align: center; color: var(--text-2); padding: 32px 0; }
.ellipsis { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-link { cursor: pointer; }
.w-actions { width: 140px; white-space: nowrap; }
.w-actions-lg { width: 260px; white-space: nowrap; }
.muted { color: var(--text-2); font-size: 13px; }
.success-text { color: var(--success); font-weight: 600; }

/* ========== 状态标签 ========== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.tag-gray { background: #f3f4f6; color: #4b5563; }
.tag-orange { background: #fff7ed; color: #c2410c; }
.tag-blue { background: #eff6ff; color: #1d4ed8; }
.tag-red { background: #fef2f2; color: #b91c1c; }
.tag-purple { background: #faf5ff; color: #7c3aed; }
.tag-green { background: #f0fdf4; color: #15803d; }
.tag-dark { background: #e5e7eb; color: #374151; }

/* ========== 分页 ========== */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 14px;
  flex-wrap: wrap;
}
.pagination-total { color: var(--text-2); font-size: 13px; margin-right: 6px; }
.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.page-ellipsis { color: var(--text-2); }

/* ========== 弹窗 ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: 8vh 16px 16px;
  overflow-y: auto;
}
.modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  max-width: calc(100vw - 32px);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-2);
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px 20px; max-height: 65vh; overflow-y: auto; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.confirm-content { font-size: 14px; }

/* ========== Toast 消息 ========== */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 22px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  animation: toast-in 0.2s ease;
  max-width: 80vw;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: #475569; }

/* ========== 加载态 ========== */
.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
  padding: 40px 0;
}
.spinner-icon {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 登录页 ========== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #2563eb 60%, #38bdf8 100%);
  padding: 20px;
}
.auth-card {
  width: 400px;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  padding: 36px 36px 28px;
}
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand h1 { font-size: 22px; color: var(--text); margin-bottom: 6px; }
.auth-brand p { color: var(--text-2); font-size: 13px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 13px; }
.auth-links a { color: var(--text-2); }
.auth-links a:hover { color: var(--primary); }

/* ========== 管理后台布局 ========== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  padding: 18px 20px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 1px;
}
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: var(--sidebar-text);
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active { background: rgba(37, 99, 235, 0.25); color: #fff; border-left-color: #60a5fa; }
.nav-icon { width: 18px; text-align: center; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-role {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.user-name { font-weight: 600; }

.content { padding: 20px 24px; flex: 1; }

/* ========== 页面通用 ========== */
.page { max-width: 1200px; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-title { font-size: 18px; }
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.page-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  padding-bottom: 24px;
}

/* ========== 工作台看板 ========== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  border-left: 4px solid var(--primary);
}
.stat-blue { border-left-color: #3b82f6; }
.stat-orange { border-left-color: #f59e0b; }
.stat-green { border-left-color: #22c55e; }
.stat-purple { border-left-color: #8b5cf6; }
.stat-cyan { border-left-color: #06b6d4; }
.stat-gray { border-left-color: #9ca3af; }
.stat-label { color: var(--text-2); font-size: 13px; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; }

/* ========== 报价单展示 ========== */
.quote-view-head, .detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.quote-no { color: var(--text-2); font-size: 13px; margin-bottom: 4px; }
.quote-title { font-size: 20px; }
.quote-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 14px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 20px;
  font-size: 14px;
}
.detail-full { grid-column: 1 / -1; }
.quote-totals {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  padding-top: 14px;
  font-size: 14px;
}
.quote-grand-total { font-size: 16px; }
.quote-grand-total b { color: var(--primary); font-size: 20px; }
.quote-remark { margin-top: 12px; color: var(--text-2); font-size: 13px; }
.quote-actions {
  display: flex;
  gap: 14px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  justify-content: center;
}

/* ========== 提示条 ========== */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-top: 12px;
}
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--info-light); color: #155e75; border: 1px solid #a5f3fc; }

/* ========== 状态时间线 ========== */
.timeline { padding: 6px 0; }
.timeline-item {
  display: flex;
  gap: 14px;
  position: relative;
  padding-bottom: 20px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 30px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.timeline-body { padding-top: 4px; }
.timeline-label { font-weight: 600; }
.timeline-time { color: var(--text-2); font-size: 12.5px; }
.timeline-note { color: var(--danger); font-size: 12.5px; }

/* ========== 链接展示框 ========== */
.link-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  word-break: break-all;
  color: var(--primary);
  margin-top: 8px;
}

/* ========== 客户门户 / 公开页 ========== */
.public-page { min-height: 100vh; background: var(--bg); }
.public-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.public-brand { font-size: 16px; font-weight: 700; color: var(--text); }
.portal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}
.portal-nav-right { display: flex; align-items: center; gap: 16px; }
.portal-link { color: var(--text); font-size: 14px; padding: 4px 2px; border-bottom: 2px solid transparent; }
.portal-link:hover { color: var(--primary); }
.portal-link.active { color: var(--primary); border-bottom-color: var(--primary); }
.portal-content { padding: 20px 24px; max-width: 1100px; margin: 0 auto; }
.public-error { margin: 40px auto; max-width: 640px; text-align: center; }
.quote-view { max-width: 900px; margin: 24px auto; }

/* ========== 404 ========== */
.not-found {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.not-found h2 { font-size: 48px; color: var(--text-2); }
