/* ============================================
   海融大网络报价管理系统 — 现代化 UI
   ============================================ */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: #f5f7fa;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: #2563eb; text-decoration: none; transition: color .15s; }
a:hover { color: #1d4ed8; }
button, input, select, textarea {
  font: inherit; color: inherit;
}

/* ===== 顶栏 ===== */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 32px;
  height: 64px;
  display: flex; align-items: center; gap: 32px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.topbar .brand {
  font-size: 17px; font-weight: 700; color: #1f2937;
  display: flex; align-items: center; gap: 8px;
}
.topbar .brand::before {
  content: "📋"; font-size: 22px;
}
.topbar nav { flex: 1; display: flex; gap: 4px; }
.topbar nav a {
  color: #6b7280; padding: 8px 14px; border-radius: 6px;
  font-size: 14px; font-weight: 500;
  transition: all .15s;
}
.topbar nav a:hover { background: #f3f4f6; color: #1f2937; text-decoration: none; }
.topbar nav a.active { background: #eff6ff; color: #2563eb; }
.topbar .user {
  display: flex; align-items: center; gap: 8px;
  color: #6b7280; font-size: 13px;
  padding: 6px 12px; background: #f9fafb; border-radius: 6px;
}
.topbar .user a { color: #6b7280; font-size: 12px; margin-left: 4px; }
.topbar .user a:hover { color: #ef4444; }

/* ===== 主区 ===== */
main { padding: 28px 32px 60px; max-width: 1280px; margin: 0 auto; }
.bottombar { text-align: center; padding: 24px; color: #9ca3af; font-size: 12px; border-top: 1px solid #e5e7eb; margin-top: 40px; }
.bottombar .muted { margin-left: 12px; }

/* ===== 标题 ===== */
h1 { font-size: 22px; margin: 0 0 20px; font-weight: 700; color: #111827; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 24px 0 12px; font-weight: 600; color: #111827; }
h3 { font-size: 14px; margin: 16px 0 8px; font-weight: 600; color: #374151; }

/* ===== 页面顶部 ===== */
.page-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;
  flex-wrap: wrap; gap: 12px;
}
.page-header h1 { margin: 0; }
.back-link { color: #6b7280; font-size: 13px; margin-bottom: 16px; display: inline-block; }
.back-link:hover { color: #2563eb; }

/* ===== 卡片 ===== */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.card {
  background: #ffffff; padding: 22px; border-radius: 10px;
  border: 1px solid #f3f4f6;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all .2s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); transform: translateY(-1px); }
.card .label { color: #6b7280; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.card .value { font-size: 26px; font-weight: 700; margin-top: 8px; color: #111827; letter-spacing: -0.01em; }
.card .value .unit { font-size: 14px; color: #9ca3af; font-weight: 500; margin-left: 4px; }
.card .delta { font-size: 12px; margin-top: 6px; }
.card .delta.up { color: #10b981; }
.card .delta.down { color: #ef4444; }
.card .icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: #eff6ff; color: #2563eb;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 12px;
}
.card.green .icon { background: #d1fae5; color: #059669; }
.card.amber .icon { background: #fef3c7; color: #d97706; }
.card.purple .icon { background: #ede9fe; color: #7c3aed; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 16px;
  background: #ffffff; border: 1px solid #e5e7eb; border-radius: 6px;
  color: #374151; font-weight: 500; font-size: 13px;
  cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn:hover { background: #f9fafb; border-color: #d1d5db; color: #111827; }
.btn-primary {
  background: #2563eb; color: #fff; border-color: #2563eb;
  box-shadow: 0 1px 2px rgba(37,99,235,0.2);
}
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.btn-danger { color: #dc2626; border-color: #fee2e2; }
.btn-danger:hover { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.btn-success { background: #10b981; color: #fff; border-color: #10b981; }
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ===== 表格 ===== */
table { width: 100%; border-collapse: separate; border-spacing: 0;
  background: #ffffff; border-radius: 10px; overflow: hidden;
  border: 1px solid #f3f4f6;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
th {
  background: #f9fafb; color: #6b7280; font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 2px solid #e5e7eb;
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #f9fafb; }
tr.row-danger td { background: #fef2f2; }
tr.row-warning td { background: #fffbeb; }
tr.row-success td { background: #f0fdf4; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: #9ca3af; }
.empty-state { text-align: center; color: #9ca3af; padding: 60px 20px; }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }

/* ===== 表单 ===== */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar form { display: inline-flex; gap: 8px; }

input, select, textarea {
  padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 6px;
  outline: none; background: #ffffff; transition: all .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
input[type=number], input[type=date] { font-variant-numeric: tabular-nums; }
input[disabled] { background: #f9fafb; color: #6b7280; cursor: not-allowed; }
textarea { width: 100%; min-height: 80px; resize: vertical; line-height: 1.6; }
select { cursor: pointer; }

.field { display: flex; flex-direction: column; margin-bottom: 16px; }
.field label {
  font-size: 12px; color: #6b7280; margin-bottom: 6px;
  font-weight: 500;
}
.field input, .field select, .field textarea { width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.checkbox-field input { width: auto; }

/* ===== 状态徽标 ===== */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-draft     { background: #f3f4f6; color: #4b5563; }
.tag-submitted { background: #dbeafe; color: #1e40af; }
.tag-approved  { background: #d1fae5; color: #065f46; }
.tag-rejected  { background: #fee2e2; color: #991b1b; }
.tag-sent      { background: #ede9fe; color: #5b21b6; }
.tag-won       { background: #10b981; color: #ffffff; }
.tag-lost      { background: #6b7280; color: #ffffff; }
.tag-cancelled { background: #fde68a; color: #92400e; }
.tag-active    { background: #d1fae5; color: #065f46; }
.tag-inactive  { background: #f3f4f6; color: #6b7280; }

/* ===== 提示 ===== */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert::before { font-size: 16px; }
.alert-error::before { content: "⚠"; }
.alert-success::before { content: "✓"; }
.alert-info::before { content: "ℹ"; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: none; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadein .15s;
}
.modal-mask.show { display: flex; }
.modal {
  background: #ffffff; border-radius: 12px; width: 720px;
  max-width: 95vw; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: slideup .2s;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideup { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  padding: 16px 24px; border-bottom: 1px solid #f3f4f6;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid #f3f4f6;
  display: flex; justify-content: flex-end; gap: 8px;
}
.close-x { background: transparent; border: 0; font-size: 22px; color: #9ca3af; cursor: pointer; padding: 0; line-height: 1; }
.close-x:hover { color: #1f2937; }

/* ===== 报价明细行 ===== */
.line-table { font-size: 12px; }
.line-table input, .line-table select { padding: 5px 8px; border: 1px solid transparent; background: transparent; border-radius: 4px; }
.line-table input:hover, .line-table select:hover { border-color: #e5e7eb; }
.line-table input:focus, .line-table select:focus { background: #fef3c7; border-color: #fbbf24; box-shadow: none; }
.line-table .num { text-align: right; }
.line-table tfoot td { background: #f9fafb; font-weight: 600; }

/* ===== 登录页 ===== */
.login-page { background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: #ffffff; padding: 44px 40px; border-radius: 16px;
  width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: slideup .3s;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; text-align: center; }
.login-card .sub { color: #6b7280; font-size: 13px; margin-bottom: 28px; text-align: center; }

/* ===== 打印 ===== */
@media print {
  .no-print, .topbar, .bottombar, form, .toolbar, button, .back-link, .page-header { display: none !important; }
  main { padding: 0; max-width: 100%; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .field-row, .field-row3 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar nav a { padding: 6px 8px; font-size: 13px; }
  main { padding: 16px; }
}
