/* ===== 定制报价协同系统 · 现代设计系统 ===== */
:root {
  --bg: #f2f4f9;
  --surface: #ffffff;
  --border: #e5e9f2;
  --text: #1a2340;
  --muted: #6b7793;
  --primary: #6fba2c;
  --primary-dark: #59921f;
  --primary-soft: #f1f8e3;
  --ok: #059669;
  --ok-soft: #e7f7f0;
  --err: #dc2626;
  --err-soft: #fdecec;
  --warn: #d97706;
  --sidebar-w: 232px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(23, 32, 77, .05);
  --shadow-md: 0 4px 16px rgba(23, 32, 77, .08);
  --shadow-lg: 0 12px 32px rgba(23, 32, 77, .14);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
::selection { background: #d8edc0; }

/* ===== 布局：侧边栏 + 主区 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: #16250c; color: #aab4d0;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  display: flex; flex-direction: column; padding: 20px 14px;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px;
  font-size: 16px; font-weight: 800; color: #fff; letter-spacing: .5px;
}
.sidebar .brand .logo {
  width: auto; height: 34px; flex: none; object-fit: contain;
  display: flex; align-items: center; justify-content: center;
}
.sidebar .nav-section { font-size: 11px; color: #5b6785; padding: 14px 12px 6px; letter-spacing: 1px; }
.sidebar a.navlink {
  display: flex; align-items: center; gap: 11px; color: #aab4d0;
  padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 3px;
  font-size: 13.5px; font-weight: 500; transition: all .18s ease;
}
.sidebar a.navlink .ico { width: 20px; text-align: center; font-size: 15px; }
.sidebar a.navlink:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.navlink.active {
  background: linear-gradient(90deg, var(--primary), #8bc63f);
  color: #fff; box-shadow: 0 4px 12px rgba(111,186,44,.4);
}
.sidebar .side-foot { margin-top: auto; font-size: 11px; color: #5b6785; padding: 10px 12px; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  gap: 14px; padding: 0 28px; position: sticky; top: 0; z-index: 30;
}
.topbar .page-name { font-size: 15px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.bell {
  position: relative; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  background: var(--bg); transition: all .18s ease;
}
.bell:hover { background: var(--primary-soft); transform: translateY(-1px); }
.bell .dot {
  position: absolute; top: 4px; right: 3px; background: #ef4444; color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; line-height: 16px;
  text-align: center; border-radius: 9px; padding: 0 4px; font-weight: 700;
  box-shadow: 0 0 0 2px #fff;
}
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 5px; border-radius: 999px; transition: background .18s; }
.user-chip:hover { background: var(--bg); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #6fba2c, #4f8c1c); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.user-chip .who b { font-size: 13px; display: block; line-height: 1.2; }
.user-chip .who span { font-size: 11px; color: var(--muted); }
.logout {
  font-size: 12px; color: var(--muted); padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); transition: all .18s;
}
.logout:hover { color: var(--err); border-color: #f3baba; background: var(--err-soft); }

.content { padding: 28px 32px 48px; max-width: 1180px; width: 100%; margin: 0 auto; animation: fadeUp .3s ease both; }

/* ===== 页面元素 ===== */
.page-title { font-size: 20px; font-weight: 800; margin-bottom: 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; letter-spacing: .3px; }
.page-title .sub { font-size: 13px; color: var(--muted); font-weight: 500; }

.card {
  background: var(--surface); border-radius: var(--radius); padding: 20px 22px;
  margin-bottom: 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  animation: fadeUp .35s ease both;
}
.card h3 { font-size: 15px; margin-bottom: 14px; color: var(--text); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card h3::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: linear-gradient(180deg, var(--primary), #8bc63f); }

/* 表格 */
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th, table.list td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); }
table.list th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; text-transform: uppercase; letter-spacing: .4px; }
table.list tbody tr { transition: background .15s; }
table.list tbody tr:hover td { background: #f7f9fe; }
table.list tbody tr:last-child td { border-bottom: none; }
table.list td a { font-weight: 600; }
/* 客户列：给足宽度，名称自动折行，避免被挤成一列一个字 */
table.list th.cust, table.list td.cust { min-width: 130px; max-width: 190px; white-space: normal; word-break: break-word; line-height: 1.5; }

/* 徽章（软色药丸） */
.badge {
  --c: #64748b;
  display: inline-block; color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--c) 25%, #ffffff);
  font-size: 12px; font-weight: 600; padding: 2px 11px;
  border-radius: 999px; white-space: nowrap;
}
.newdot { color: #ef4444; font-weight: 900; margin-left: 4px; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; border-radius: var(--radius-sm);
  padding: 8px 18px; font-size: 13.5px; font-weight: 600; font-family: inherit;
  transition: all .18s ease; white-space: nowrap; position: relative;
}
.btn.primary { background: linear-gradient(135deg, #6fba2c, #4f8c1c); color: #fff; box-shadow: 0 3px 10px rgba(111,186,44,.35); }
.btn.green { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 3px 10px rgba(5,150,105,.3); }
.btn.red { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 3px 10px rgba(220,38,38,.3); }
.btn.gray { background: #eef1f7; color: #3d4a68; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn.sm { padding: 5px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.loading { pointer-events: none; opacity: .75; }
.btn.loading::after {
  content: ""; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.btn.gray.loading::after { border-color: rgba(61,74,104,.25); border-top-color: #3d4a68; }
@keyframes spin { to { transform: rotate(360deg); } }

form.inline { display: inline-flex; gap: 6px; align-items: center; }

/* 表单控件 */
input[type=text], input[type=password], input[type=number], select, textarea {
  border: 1px solid #dbe2ef; border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 13.5px; font-family: inherit; background: #fbfcfe; color: var(--text);
  transition: all .18s ease;
}
input:hover, select:hover, textarea:hover { border-color: #c3cde3; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(111,186,44,.15); }
textarea { width: 100%; resize: vertical; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px 22px; }
.form-grid label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.form-grid .full { grid-column: 1 / -1; }
.req { color: #ef4444; }

/* 胶囊勾选（段差/避空/钝化） */
.chips { display: flex; gap: 10px; align-items: center; padding-top: 22px; flex-wrap: wrap; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 7px 20px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid #dbe2ef; color: var(--muted); font-size: 13px; font-weight: 600;
  background: #fbfcfe; transition: all .18s ease; user-select: none;
}
.chip span:hover { border-color: var(--primary); color: var(--primary); }
.chip input:checked + span {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary);
  box-shadow: 0 2px 8px rgba(111,186,44,.22);
}

/* 文件上传 */
.file-drop {
  border: 2px dashed #cdd7ea; border-radius: var(--radius); padding: 22px;
  text-align: center; color: var(--muted); cursor: pointer; transition: all .2s ease;
  background: #fbfcfe; font-size: 13px;
}
.file-drop:hover, .file-drop.dragover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.file-drop input { display: none; }
.file-drop .fname { color: var(--primary); font-weight: 600; }

/* Toast 通知 */
#toast-box { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px;
  border-radius: 12px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.2,.9,.3,1.3) both; border: 1px solid;
}
.toast.ok { background: var(--ok-soft); color: #046c4e; border-color: #b6e7d3; }
.toast.error { background: var(--err-soft); color: #991b1b; border-color: #f5c2c2; }
.toast .tico { font-size: 15px; }
.toast.out { animation: toastOut .3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* 模态确认框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16,26,51,.45); backdrop-filter: blur(3px);
  z-index: 90; display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease both; padding: 20px;
}
.modal {
  background: #fff; border-radius: 18px; padding: 26px 28px; width: 400px; max-width: 100%;
  box-shadow: var(--shadow-lg); animation: popIn .25s cubic-bezier(.2,.9,.3,1.3) both;
}
.modal .m-title { font-size: 16px; font-weight: 800; margin-bottom: 10px; }
.modal .m-body { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; line-height: 1.7; }
.modal .m-actions { display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.92) translateY(10px); } }

/* 标签页（分段控件） */
.tabs { display: inline-flex; gap: 2px; background: #e8ecf5; border-radius: 999px; padding: 4px; margin-bottom: 18px; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; }
.tabs a {
  padding: 6px 16px; border-radius: 999px; color: #55617f; font-size: 13px; font-weight: 600;
  transition: all .18s ease; white-space: nowrap;
}
.tabs a.on { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }
.tabs a:hover:not(.on) { color: var(--text); }

/* 键值信息区 */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 13px 26px; }
.kv .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.kv .v { font-size: 14px; margin-top: 2px; word-break: break-all; font-weight: 600; }

/* 时间线 */
.timeline { list-style: none; }
.timeline li { position: relative; padding: 0 0 18px 24px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; border: 3px solid var(--primary);
}
.timeline li:last-child::before { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.timeline .t { font-size: 12px; color: var(--muted); }
.timeline .a { font-weight: 700; }
.timeline .d { color: var(--muted); margin-top: 2px; font-size: 13px; }

/* 价格区 */
.price-box {
  background: linear-gradient(120deg, #f1f8e3, #f7fbf0); border: 1px solid #e0eec8;
  border-radius: var(--radius); padding: 20px 24px;
  display: flex; gap: 38px; align-items: baseline; flex-wrap: wrap; margin-bottom: 18px;
}
.price-box .num { font-size: 24px; font-weight: 800; color: var(--primary); letter-spacing: .3px; }
.price-box .lbl { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.price-box .grand .num, .price-box div .num.grand { color: var(--ok); }

table.breakdown { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.breakdown td, table.breakdown th { padding: 8px 12px; border-bottom: 1px solid var(--border); }
table.breakdown th { color: var(--muted); font-size: 12px; text-align: left; }
/* 供应商端：含税供应价行高亮 */
table.breakdown tr.hl-tax td {
  background: #eaf6da;
  color: #2f6b10;
  font-weight: 700;
  font-size: 14.5px;
}

.miss { background: var(--err-soft); color: var(--err); border: 1px solid #f5c2c2; padding: 12px 16px; border-radius: var(--radius-sm); margin: 8px 0; font-weight: 600; font-size: 13.5px; }

/* 通知已读/未读区分 */
table.list tr.nt-unread td { background: var(--primary-soft); font-weight: 600; }
table.list tr.nt-unread td:first-child { border-left: 3px solid var(--primary); }
table.list tr.nt-read td { color: var(--muted); }
table.list tr.nt-read td a { color: var(--muted); font-weight: 500; }

/* 空状态 */
.empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty .eico { font-size: 42px; margin-bottom: 12px; opacity: .8; }
.empty .etxt { font-size: 14px; margin-bottom: 16px; }

/* 登录页 */
body.guest { background: linear-gradient(135deg, #101c08 0%, #1b3010 55%, #2f5212 100%); min-height: 100vh; }
.login-wrap { max-width: 400px; margin: 0 auto; padding: 9vh 20px 40px; }
.login-brand { text-align: center; color: #fff; margin-bottom: 26px; }
.login-brand .logo {
  height: 64px; width: auto; margin: 0 auto 14px; object-fit: contain;
  display: flex; align-items: center; justify-content: center;
}
.login-brand h1 { font-size: 21px; font-weight: 800; letter-spacing: 1px; }
.login-brand p { font-size: 13px; color: #9aa5c8; margin-top: 6px; }
.login-wrap .card { padding: 32px 30px; border-radius: 20px; border: none; box-shadow: var(--shadow-lg); }
.login-wrap label { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 0 5px; font-weight: 600; }
.login-wrap input { width: 100%; padding: 10px 13px; }
.login-wrap .btn { width: 100%; margin-top: 20px; padding: 11px; font-size: 14.5px; border-radius: 12px; }
.login-hint { font-size: 12px; color: var(--muted); margin-top: 18px; line-height: 2; background: #f4f6fc; border-radius: 12px; padding: 12px 14px; }

/* 动画 */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 信息提示条 */
.notice { background: var(--primary-soft); color: var(--primary); border: 1px solid #e0eec8; padding: 12px 16px; border-radius: var(--radius-sm); margin: 8px 0; font-weight: 600; font-size: 13.5px; }

/* 响应式 */
@media (max-width: 860px) {
  .sidebar { width: 64px; padding: 16px 8px; }
  .sidebar .brand div span, .sidebar .nav-section, .sidebar a.navlink em { display: none; }
  .sidebar a.navlink { justify-content: center; padding: 10px; }
  .main { margin-left: 64px; }
  .content { padding: 20px 16px 40px; }
}

/* 打印：只保留正文内容（报价单等），隐藏导航/顶栏/工具栏/弹层 */
@media print {
  .sidebar, .topbar, .quote-toolbar, #toast-box, .modal-mask, .flash { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; max-width: none !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: none !important; }
  #quote-card { border: none !important; width: 100% !important; }
}
