/* ==========================================================================
   百家门 · 包装档案管理平台 样式
   为什么这么写：V1.3 是全新平台，不复用旧后台样式。这里用 CSS 变量统一设计语言，
   一套样式覆盖四套工作台（客户/客服/设计师/平台），避免各视图各写一套导致视觉分裂。
   ========================================================================== */
:root {
  /* 为什么整体提亮并降饱和：深蓝偏沉，浅蓝灰 + 同色系渐变更通透，科技感来自层次而非重色。 */
  --primary: #3b6fd4;
  --primary-dark: #2b56a8;
  --primary-soft: #eef4fd;
  --primary-glow: rgba(59, 111, 212, .14);
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --text: #1e293b;
  --text-sub: #64748b;
  --line: #e4ebf5;
  --bg: #f5f8fd;
  --card: #ffffff;
  --sidebar: #213a63;
  --sidebar-sub: #9fb6d9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(33, 58, 99, .05), 0 4px 12px rgba(33, 58, 99, .05);
  --shadow-lg: 0 16px 40px rgba(33, 58, 99, .16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
.boot-loading { padding: 40px; color: var(--text-sub); }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: linear-gradient(135deg, #dbe7fa 0%, #b9d0f2 50%, #a8c8e8 100%);
}
.login-box {
  width: 420px;
  max-width: calc(100vw - 32px);
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 28px;
}
.login-box h1 { margin: 0 0 4px; font-size: 24px; text-align: center; }
.login-box .sub { text-align: center; color: var(--text-sub); margin-bottom: 24px; }
.login-box .logo {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 14px;
  background: var(--primary); color: #fff; display: flex; align-items: center;
  justify-content: center; font-size: 24px; font-weight: 700;
}
.login-box .hint { font-size: 12px; color: var(--text-sub); margin-top: 18px; line-height: 1.7; }
/* 为什么加登录标题与链接区：把「商家工作台」做主视觉、注册入口做醒目引导，
   内部账号只留底部一行浅色文字，避免商家误入管理入口。 */
.login-title {
  font-size: 17px; font-weight: 600; text-align: center; color: var(--text);
  margin: 0 0 20px; padding-top: 18px; border-top: 1px solid var(--line);
}
.login-foot {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 18px; font-size: 13px; color: var(--text-sub);
}
.login-foot .sep { color: var(--line); }
.link-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--primary); font-weight: 600; font-size: 13px;
}
.link-btn:hover { text-decoration: underline; }
.login-admin { text-align: center; margin-top: 22px; }
.login-admin button {
  border: 0; background: none; cursor: pointer;
  color: var(--text-sub); font-size: 11px; opacity: .7;
}
.login-admin button:hover { color: var(--primary); opacity: 1; }
/* 为什么单独做返回按钮：内部账号页要给商家一个明确的退路，又不能和主登录按钮抢焦点。 */
.login-back { margin-top: 16px; }
.login-back .btn { width: 100%; }
.btn-lg { padding: 12px 18px; font-size: 15px; font-weight: 600; }
/* 为什么悬挂在页面底部：备案号要常驻可见，又不能挤进登录卡片干扰主流程。 */
.login-beian {
  position: fixed; bottom: 14px; left: 0; right: 0; text-align: center;
  font-size: 12px; color: var(--text-sub);
}
.login-beian a { color: inherit; text-decoration: none; }
.login-beian a:hover { color: var(--primary); text-decoration: underline; }

/* ---------- 布局：侧边栏 + 顶栏 + 内容 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; color: #fff;
  /* 为什么渐变：从深蓝到略浅的同色过渡，配细高光边做出磨砂玻璃质感，避免整块死黑。 */
  background: linear-gradient(165deg, #274672 0%, var(--sidebar) 55%, #1b3257 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 20px;
  font-size: 16px; font-weight: 600; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-group-title {
  padding: 14px 20px 6px; font-size: 11px; letter-spacing: .08em;
  color: var(--sidebar-sub); text-transform: uppercase;
}
/* 业务平台下的二级分区：比主分组缩进一级，避免和菜单项抢视觉层级。 */
.nav-sub-title {
  padding: 10px 20px 4px 32px; font-size: 10px; letter-spacing: .06em;
  color: var(--sidebar-sub); opacity: .85;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  color: #d1d5db; cursor: pointer; border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(147,197,253,.22), rgba(147,197,253,.04));
  color: #fff; border-left-color: #93c5fd;
  box-shadow: inset 0 0 0 1px rgba(147,197,253,.08);
}
.nav-item .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: var(--sidebar-sub); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; flex: 0 0 64px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 18px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 12px; color: var(--text-sub); }
.topbar .user .role-chip {
  background: var(--primary-soft); color: var(--primary); padding: 3px 10px;
  border-radius: 999px; font-size: 12px;
}
.content { padding: 24px; flex: 1; }

/* ---------- 卡片 / 栅格 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.7);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat-card { padding: 18px 20px; }
.stat-card .label { color: var(--text-sub); font-size: 13px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat-card .trend { font-size: 12px; color: var(--text-sub); margin-top: 4px; }

/* ---------- 选项卡（Tabs） ---------- */
/* 为什么放这里：档案与文件资产合并后共用一组 Tab，样式统一在一处，
   避免每个视图各写一套导致选中态和间距不一致。 */
.tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.tab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 10px 18px; font-size: 14px; color: var(--text-sub);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.tab-panel[hidden] { display: none; }

/* 档案列表「服务申请」入口：比普通链接更醒目，避免用户漏点 */
.link-apply {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  font-size: 14px; font-weight: 600; line-height: 1.5;
  color: var(--primary); background: var(--primary-soft);
  border-radius: 5px; text-decoration: none;
}
.link-apply:hover { color: #fff; background: var(--primary); }

/* ---------- 签字稿缩览图 ---------- */
.sign-thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.sign-thumb-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 92px; padding: 6px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer;
}
.sign-thumb-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.sign-thumb { width: 76px; height: 56px; object-fit: cover; background: #f3f4f6; border-radius: 4px; }
.sign-thumb-file { display: flex; align-items: center; justify-content: center; width: 76px; height: 56px; font-size: 26px; background: #f3f4f6; border-radius: 4px; }
.sign-thumb-name { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--text-sub); }
.sign-lightbox {
  /* 为什么全透明：用户要求放大看图时不遮挡页面内容，点图片外区域仍可关闭，右上也有关闭按钮。 */
  position: fixed; inset: 0; z-index: 9999; background: transparent;
  display: flex; align-items: center; justify-content: center; padding: 32px;
}
.sign-lightbox[hidden] { display: none; }
.sign-lightbox-inner { max-width: 92vw; max-height: 92vh; display: flex; flex-direction: column; gap: 10px; }
/* 为什么文字改深色：蒙层透明后底层是浅色页面，原来的白字会看不清。 */
.sign-lightbox-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--text); }
.sign-lightbox-title { font-size: 14px; }
.sign-lightbox-tools { display: flex; align-items: center; gap: 8px; }
.sign-lightbox-bar button { padding: 6px 14px; border: 0; border-radius: 6px; background: #fff; color: var(--text); cursor: pointer; }
.sign-lightbox-bar button[data-act="zoom-in"], .sign-lightbox-bar button[data-act="zoom-out"] { min-width: 34px; padding: 6px 8px; font-size: 16px; }
.sign-lightbox-scale { min-width: 48px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
/* 为什么固定舞台并隐藏溢出：图片放大后不能把灯箱撑破，滚动由舞台内部处理。 */
.sign-lightbox-stage { overflow: auto; max-width: 92vw; max-height: 86vh; display: flex; align-items: center; justify-content: center; }
.sign-lightbox-img {
  max-width: 92vw; max-height: 82vh; object-fit: contain; background: #fff; border-radius: 6px;
  transform-origin: center center; transition: transform .15s ease;
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { background: #f9fafb; color: var(--text-sub); font-weight: 600; font-size: 12px; }
.table tbody tr:hover { background: #fafbff; }
.table td .sub { color: var(--text-sub); font-size: 12px; }
.table .text-right { text-align: right; }
.empty { padding: 44px 20px; text-align: center; color: var(--text-sub); }

/* ---------- 状态标签 ---------- */
.tag {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; line-height: 1.6; background: #f3f4f6; color: #4b5563;
}
.tag.primary { background: var(--primary-soft); color: var(--primary); }
.tag.success { background: #dcfce7; color: var(--success); }
.tag.warning { background: #fef3c7; color: var(--warning); }
.tag.danger  { background: #fee2e2; color: var(--danger); }
.tag.info    { background: #cffafe; color: var(--info); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 8px; cursor: pointer; transition: all .15s; font-size: 13px;
}
.btn:hover { border-color: #c7cbd1; background: #f9fafb; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-link { border: none; background: none; color: var(--primary); padding: 4px 6px; }
.btn-link:hover { background: none; text-decoration: underline; }
/* 为什么给删除按钮单独着色：不可逆操作要和普通「编辑/停用」区分，避免误点。 */
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { color: var(--danger); text-decoration: underline; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
/* 为什么单独给选文件按钮做主色虚线框：它是提交稿件弹窗里唯一必须操作的一步，
   原来灰白色小按钮在表单里几乎看不出来，用户会以为没有上传入口。 */
.btn-pick-file {
  border: 1px dashed var(--primary); background: var(--primary-soft); color: var(--primary);
  padding: 10px 20px; font-weight: 600;
}
.btn-pick-file:hover { background: var(--primary); border-style: solid; color: #fff; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; color: #374151; font-weight: 500; }
.field .required { color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; color: var(--text); outline: none; transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow);
}
.field textarea { min-height: 84px; resize: vertical; }
.field .help { font-size: 12px; color: var(--text-sub); }
.form-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: flex-end; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.toolbar input, .toolbar select {
  padding: 8px 11px; border: 1px solid #d1d5db; border-radius: 8px; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }
.toolbar input[type="search"] { min-width: 220px; }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 16px; }
.pagination .info { color: var(--text-sub); font-size: 12px; margin-right: auto; }
.pagination button {
  min-width: 32px; padding: 6px 10px; border: 1px solid var(--line); background: #fff;
  border-radius: 6px; cursor: pointer;
}
.pagination button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
/* 为什么这么写：弹窗用 flex 列布局，只让 body 滚动；标题与操作按钮固定在顶部，不随内容滚走。 */
.modal {
  background: #fff; border-radius: 12px; width: 560px; max-width: 100%;
  max-height: 86vh; overflow: hidden; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.modal.large { width: 860px; }
.modal-head {
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex: 0 0 auto;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.modal-actions { display: flex; align-items: center; gap: 10px; }
.modal-head .close { cursor: pointer; color: var(--text-sub); font-size: 20px; line-height: 1; border: none; background: none; }
.modal-body { padding: 20px; flex: 1 1 auto; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- toast / loading ---------- */
.toast-box { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 220px; max-width: 360px; padding: 12px 16px; border-radius: 8px;
  background: var(--sidebar); color: #fff; box-shadow: var(--shadow-lg); font-size: 13px;
  animation: toast-in .2s ease-out;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.loading-mask {
  position: fixed; inset: 0; z-index: 300; background: rgba(255,255,255,.55);
  display: flex; align-items: center; justify-content: center;
}
.loading-mask .spinner {
  width: 38px; height: 38px; border: 3px solid #dbe3ef; border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 详情 / 时间线 / 辅助 ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 24px; }
.detail-item .k { color: var(--text-sub); font-size: 12px; }
.detail-item .v { margin-top: 3px; word-break: break-all; }
.section-title { font-size: 14px; font-weight: 600; margin: 22px 0 10px; padding-left: 9px; border-left: 3px solid var(--primary); }
/* 为什么独立突出：需求说明是设计对齐的核心，放大字号并加左侧色条，避免被当作普通键值浏览过去。 */
.brief-block {
  background: var(--primary-soft); border: 1px solid #bfdbfe; border-left: 4px solid var(--primary);
  border-radius: 10px; padding: 14px 18px; margin: 0 0 18px;
}
.brief-title { font-size: 15px; font-weight: 700; color: var(--primary-dark); margin-bottom: 8px; }
.brief-content { font-size: 16px; font-weight: 600; line-height: 1.8; color: var(--text); white-space: pre-wrap; word-break: break-word; }
/* 为什么：项目详情分区展示，标题/标签/内容用字号与粗细分层，避免所有信息看起来一样重。 */
.pd-section { border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; background: #fff; }
.pd-section-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 12px; padding-left: 9px; border-left: 3px solid var(--primary); }
.pd-hero { border-color: #bfdbfe; background: var(--primary-soft); }
.pd-hero .pd-section-title { color: var(--primary-dark); font-size: 16px; }
.pd-brief { font-size: 15px; font-weight: 600; color: var(--primary); line-height: 1.7; white-space: pre-wrap; }
.pd-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 24px; }
@media (max-width: 900px) { .pd-grid { grid-template-columns: 1fr; } }
.pd-item .pd-k { color: var(--text-sub); font-size: 12px; font-weight: 400; }
.pd-item .pd-v { margin-top: 3px; font-size: 14px; font-weight: 600; color: var(--text); word-break: break-all; }
.design-file-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.note-warn { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.note-info { background: var(--primary-soft); border: 1px solid #bfdbfe; color: var(--primary-dark); padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: ''; position: absolute; left: -6px; top: 2px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary);
}
.timeline li .t { color: var(--text-sub); font-size: 12px; }
.muted { color: var(--text-sub); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.text-right { text-align: right; }
