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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6fa;
  color: #1e293b;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; min-height: 100vh; }

/* stage14：Vue 挂载前隐藏模板，避免闪现 mustache 原始标记 */
[v-cloak] { display: none; }

/* 侧边栏 */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #0b1220 0%, #101c36 100%);
  color: #e2e8f0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid #1e293b;
}

.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #4f7cff, #2563eb);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.logo-title { font-size: 16px; font-weight: 600; color: #fff; }
.logo-sub { font-size: 12px; color: #64748b; margin-top: 2px; }

.nav { padding: 12px 8px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #cbd5e1;
  margin-bottom: 2px;
  transition: all 0.15s;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, #4f7cff, #2563eb);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.nav-icon { font-size: 16px; }

/* 主内容 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: #fff;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eef2f7;
  box-shadow: 0 1px 8px rgba(15, 23, 42, 0.04);
  position: relative;
  z-index: 10;
}

.topbar-title { font-size: 18px; font-weight: 600; }

.factory-select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  min-width: 200px;
  background: #fff;
}

.topbar-actions { display: flex; align-items: center; gap: 16px; }

.account-box {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 16px;
  border-left: 1px solid #e2e8f0;
}

.account-name { font-size: 13px; font-weight: 600; color: #334155; margin-right: 6px; }

.btn-link {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
}
.btn-link:hover { text-decoration: underline; }

.content { flex: 1; padding: 24px; overflow-y: auto; }

/* 卡片 */
.panel {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #0f172a;
}

/* 数据概览 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  padding: 24px;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
  border-top: 3px solid #2563eb;
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:nth-child(2) { border-top-color: #22c55e; }
.stat-card:nth-child(3) { border-top-color: #f59e0b; }
.stat-card:nth-child(4) { border-top-color: #8b5cf6; }
.stat-card:nth-child(5) { border-top-color: #06b6d4; }
.stat-card:nth-child(6) { border-top-color: #ec4899; }
.stat-card:nth-child(7) { border-top-color: #64748b; }

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); }

.stat-label { font-size: 13px; color: #64748b; margin-bottom: 12px; }
.stat-value { font-size: 32px; font-weight: 700; color: #0f172a; }

/* 表格 */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding: 12px 16px;
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }

.text-price { color: #e11d48; font-weight: 600; }
.muted { color: #94a3b8; font-size: 13px; }
.empty { text-align: center; color: #94a3b8; padding: 40px 0; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 500;
}

/* 021/022 设计稿：订单/询价表格内的稿图缩略图与备注（点击缩略图新标签开原图，浏览器可另存） */
.design-thumb {
  height: 46px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: zoom-in;
  vertical-align: middle;
  margin-right: 6px;
}
.design-thumb:hover { border-color: #2563eb; }
.design-note-line {
  max-width: 200px;
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 024 印刷制版 PDF 下载链接（排版工具产出的矢量文件，随设计稿一并下发工厂） */
.design-pdf-line {
  margin-top: 4px;
  font-size: 12px;
  white-space: nowrap;
}
.design-pdf-line a {
  color: #2563eb;
  text-decoration: none;
}
.design-pdf-line a:hover { text-decoration: underline; }

/* 表单 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.form-item label {
  display: block;
  font-size: 13px;
  color: #64748b;
  margin-bottom: 6px;
}

.form-item input,
.form-item select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}

.form-item input:focus,
.form-item select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-item.full { grid-column: 1 / -1; }

.check-group { display: flex; flex-wrap: wrap; gap: 12px; }
.check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #f8fafc;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.check-item input { width: auto; }

/* Stage8 联动：当前品类不可用的工艺置灰禁用 */
.check-item.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

select option:disabled {
  color: #cbd5e1;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* 按钮 */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: linear-gradient(135deg, #4f7cff, #2563eb);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover { background: linear-gradient(135deg, #3b6bff, #1d4ed8); box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary { background: #f1f5f9; color: #334155; }
.btn-secondary:hover { background: #e2e8f0; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }

/* 报价结果 */
.result-header {
  background: linear-gradient(135deg, #4f7cff, #1d4ed8);
  color: #fff;
  padding: 28px;
  border-radius: 14px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
}

.result-price { font-size: 42px; font-weight: 700; margin-bottom: 8px; }
.result-price .unit { font-size: 22px; }
.result-price .suffix { font-size: 16px; opacity: 0.8; }
.result-total { font-size: 14px; opacity: 0.9; }

.breakdown { display: grid; gap: 12px; }
.bd-item {
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
}
.bd-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.bd-name { font-weight: 600; color: #334155; }
.bd-cost { font-weight: 600; color: #e11d48; }
.bd-detail { font-size: 12px; color: #94a3b8; }

/* 覆盖表单 */
.override-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
}

.override-form select,
.override-form input {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  flex: 1;
}

/* 面板头部（带操作按钮） */
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.panel-head .panel-title { margin-bottom: 0; }
.panel-actions { display: flex; gap: 8px; }

/* 数据看板：近 7 天趋势柱状图 */
.trend-legend { display: flex; gap: 16px; font-size: 13px; color: #64748b; align-items: center; }
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
.dot-inquiry { background: #2563eb; }
.dot-order { background: #22c55e; }

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  height: 220px;
  padding: 8px 4px 0;
}

.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.trend-bars {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.trend-bar {
  width: 18px;
  border-radius: 4px 4px 0 0;
  transition: height 0.3s;
}
.trend-inquiry { background: #2563eb; }
.trend-order { background: #22c55e; }
.trend-x { font-size: 12px; color: #94a3b8; margin-top: 8px; }

/* 数据看板：两列布局与状态分布条 */
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-cols .panel { margin-bottom: 20px; overflow: hidden; }

.dist-list { display: grid; gap: 14px; }
.dist-row { display: flex; align-items: center; gap: 12px; }
.dist-label { width: 64px; font-size: 13px; color: #475569; flex-shrink: 0; }
.dist-track {
  flex: 1;
  height: 10px;
  background: #f1f5f9;
  border-radius: 5px;
  overflow: hidden;
}
.dist-bar { height: 100%; border-radius: 5px; transition: width 0.3s; }
.dist-count { width: 32px; text-align: right; font-size: 13px; color: #334155; font-weight: 600; }

/* 登录遮罩：品牌渐变背景 + 玻璃拟态卡片 */
#login-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(11, 18, 32, 0.92), rgba(29, 55, 120, 0.9));
  backdrop-filter: blur(6px);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: #fff;
  border-radius: 18px;
  padding: 40px 36px 36px;
  width: 380px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.login-box::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #4f7cff, #2563eb, #1d4ed8);
  margin: -40px -36px 28px;
}

.login-title { font-size: 20px; font-weight: 700; text-align: center; color: #0f172a; }
.login-sub { font-size: 13px; color: #64748b; text-align: center; margin: 10px 0 20px; }

.login-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 12px;
}

.login-box input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-error { color: #dc2626; font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.login-box .btn { width: 100%; }

/* ===== Stage11 统一弹框（dialog.js） ===== */
.ui-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ui-dialog {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  animation: ui-dialog-in 0.16s ease-out;
}

@keyframes ui-dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.ui-dialog-title { font-size: 16px; font-weight: 700; color: #0f172a; margin-bottom: 10px; }
.ui-dialog-msg { font-size: 14px; color: #475569; line-height: 1.6; word-break: break-all; }

.ui-dialog-input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
}

.ui-dialog-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ui-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ===== Stage11 目录编辑弹窗（fixed 居中，不再压在页面底部） ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 20px 20px;
  overflow-y: auto;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  animation: ui-dialog-in 0.16s ease-out;
}

/* ===== stage14 设计变量与统一美化（克制覆盖，不动结构） ===== */
:root {
  --primary: #2563eb;
  --primary2: #4f7cff;
  --text: #1e293b;
  --muted: #94a3b8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
}

/* 表格：单元格垂直居中统一（表头浅灰底 / 行 hover 沿用既有规则） */
.table th, .table td { vertical-align: middle; }

/* 侧边栏：激活项左侧 3px 主色指示条 + 微渐变背景；nav-item 圆角统一 10px */
.nav-item { position: relative; border-radius: 10px; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(79, 124, 255, 0.24), rgba(37, 99, 235, 0.10));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(79, 124, 255, 0.28);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--primary2), var(--primary));
}

/* 按钮统一：btn-primary 渐变主色（沿用）；btn-secondary 改为白底描边 */
.btn-secondary { background: #fff; border: 1px solid #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #f8fafc; }

/* panel 标题区：主标题加粗 15px + 副标题 muted 12px */
.panel-title { font-size: 15px; }
.panel-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }

/* topbar 阴影分隔加强；空态统一 muted */
.topbar { box-shadow: 0 1px 12px rgba(15, 23, 42, 0.07); }
.empty { color: var(--muted); }

/* ===== stage14 SaaS 新组件：登录身份 tab / 搜索框 / 头部工具区 ===== */
.head-tools { display: flex; gap: 8px; align-items: center; }

.search-input {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  width: 220px;
  background: #f8fafc;
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: #fff;
}

.login-tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0 0;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
}
.login-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.login-tab.on {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

/* ---------- F-167/168 配置驱动菜单 + F-173 顶部角色 ---------- */
.nav-soon { opacity: 0.45; }

.role-badge {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 600;
  margin-right: 8px;
}
.role-admin { background: #eff6ff; color: #2563eb; }
.role-factory { background: #ecfdf5; color: #059669; }

.stat-sub { font-size: 13px; font-weight: 400; color: #94a3b8; margin-left: 4px; }

/* ---------- F-81/82 登录页协议链接 ---------- */
.login-legal { margin-top: 14px; font-size: 12px; color: #94a3b8; text-align: center; }
.login-legal a { color: #2563eb; text-decoration: none; }
.login-legal a:hover { text-decoration: underline; }
