/* ============ 需求协作系统 UI ============ */
:root {
  --primary: #2f54eb;
  --primary-dark: #1d39c4;
  --bg: #f4f6fa;
  --card: #ffffff;
  --border: #e6e9f0;
  --text: #1f2430;
  --text-2: #5c6470;
  --text-3: #9aa1ad;
  --danger: #d93025;
  --success: #1a936f;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 60, .06), 0 4px 16px rgba(20, 30, 60, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
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 { text-decoration: underline; }

/* ---- 布局 ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: #171c2c; color: #cdd3e1;
  display: flex; flex-direction: column;
}
.sidebar .brand {
  padding: 20px 18px; font-size: 16px; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  letter-spacing: .5px;
}
.sidebar .brand small { display: block; font-size: 11px; font-weight: 400; color: #7e879c; margin-top: 2px; }
.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav a {
  display: block; padding: 10px 14px; margin-bottom: 2px;
  color: #cdd3e1; border-radius: 8px; font-size: 14px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .side-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #7e879c; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .user-box { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 13px; }
.content { padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* ---- 客户端简化布局 ---- */
.customer-shell { max-width: 860px; margin: 0 auto; padding: 0 16px 60px; }
.customer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; margin-bottom: 8px;
}
.customer-header .logo { font-size: 18px; font-weight: 700; color: var(--text); }
.customer-nav a { margin-left: 16px; font-size: 14px; }

/* ---- 卡片 ---- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; }
.card h3 { margin: 0 0 10px; font-size: 14px; color: var(--text-2); }

/* ---- 统计卡 ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat .num { font-size: 26px; font-weight: 700; }
.stat .label { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* ---- 表格 ---- */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list th { color: var(--text-2); font-weight: 500; font-size: 13px; background: #fafbfd; white-space: nowrap; }
table.list tr:hover td { background: #f8faff; }

/* ---- 徽章 ---- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.badge-gray   { background: #eef0f4; color: #5c6470; }
.badge-blue   { background: #e8efff; color: #2f54eb; }
.badge-cyan   { background: #e0f7fa; color: #0e7490; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-orange { background: #fff3e0; color: #c2540a; }
.badge-green  { background: #e3f6ee; color: #14795a; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red    { background: #fdecea; color: #c5221f; }

/* ---- 按钮 ---- */
.btn {
  display: inline-block; padding: 8px 18px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; font-size: 14px;
  background: var(--primary); color: #fff; line-height: 1.5;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-outline { background: #fff; color: var(--text); border-color: #cfd4de; }
.btn-outline:hover { background: #f4f6fa; color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b3261e; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #137257; }
.btn-sm { padding: 4px 12px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- 表单 ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-group .hint { color: var(--text-3); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=date], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #cfd4de; border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,84,235,.12); }
textarea { min-height: 160px; resize: vertical; }
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.form-inline .form-group { margin-bottom: 0; }
.form-inline input, .form-inline select { width: auto; }

/* ---- 提示 ---- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e3f6ee; color: #14795a; border: 1px solid #b7e6d4; }
.alert-error { background: #fdecea; color: #c5221f; border: 1px solid #f5c6c2; }
.alert-info { background: #e8efff; color: #2f54eb; border: 1px solid #c9d8ff; }
.error-list { margin: 0; padding-left: 18px; }

/* ---- 登录页 ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg,#1c2440 0%, #2f54eb 100%); padding: 20px; }
.login-card { width: 380px; background: #fff; border-radius: 14px; padding: 34px 32px; box-shadow: 0 20px 60px rgba(10,20,60,.35); }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .sub { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }

/* ---- 图片 ---- */
.thumb-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb-grid a { display: block; }
.thumb-grid img {
  width: 120px; height: 120px; object-fit: cover;
  border: 1px solid var(--border); border-radius: 8px; display: block;
}
.thumb-grid .thumb-name { font-size: 11px; color: var(--text-3); width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 上传预览 */
#preview-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
#preview-grid .p-item { position: relative; }
#preview-grid img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
#preview-grid .p-size { font-size: 11px; color: var(--text-3); text-align: center; }

/* ---- 时间线 ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--border); margin-left: 8px; }
.timeline li:last-child { 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 .t-time { color: var(--text-3); font-size: 12px; }

/* ---- 沟通记录 ---- */
.chat-item { display: flex; gap: 10px; margin-bottom: 14px; }
.chat-item .avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
}
.avatar-admin { background: var(--primary); }
.avatar-user { background: #14795a; }
.chat-item .bubble { background: #f6f8fc; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; max-width: 100%; }
.chat-item .meta { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.chat-item.system .bubble { background: #fffbe6; border-color: #f5e6a9; color: #7a5c00; font-size: 13px; }
.chat-item .bubble .body { white-space: pre-wrap; word-break: break-word; }

/* ---- 其他 ---- */
.muted { color: var(--text-3); }
.mb0 { margin-bottom: 0; }
.mt16 { margin-top: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pre-content { white-space: pre-wrap; word-break: break-word; background: #fafbfd; border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.pagination { margin-top: 16px; display: flex; gap: 6px; }
.pagination a, .pagination span {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: 13px;
}
.pagination span.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }

/* ---- 语言切换器 ---- */
.lang-select {
  width: auto; padding: 5px 8px; font-size: 13px;
  border: 1px solid #cfd4de; border-radius: 6px; background: #fff; color: var(--text);
}
.customer-nav .lang-select { margin-right: 12px; }
.login-lang { text-align: right; margin-bottom: 10px; }

/* ============ 移动端适配 ============ */
.menu-toggle {
  display: none; background: none; border: 1px solid #cfd4de; border-radius: 8px;
  padding: 6px 10px; font-size: 18px; line-height: 1; cursor: pointer; color: var(--text);
}

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }

  /* 后台：侧边栏变为抽屉，由汉堡按钮控制 */
  .app-shell { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
    width: 240px; transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask {
    display: none; position: fixed; inset: 0; z-index: 999;
    background: rgba(15, 20, 35, .45);
  }
  .sidebar-mask.show { display: block; }
  .menu-toggle { display: inline-block; }
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar .page-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .user-box span { display: none; } /* 小屏隐藏用户名，保留退出按钮 */
  .content { padding: 14px; }

  /* 表格横向滚动，不撑破页面 */
  table.list { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.list th, table.list td { white-space: nowrap; }
  table.list td:nth-child(2) { white-space: normal; min-width: 160px; }

  /* 筛选/内联表单堆叠 */
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline .form-group { margin-bottom: 10px; }
  .form-inline input, .form-inline select { width: 100%; }

  /* 统计卡两列 */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px; }
  .stat .num { font-size: 22px; }

  /* 客户端头部堆叠 */
  .customer-shell { padding: 0 12px 40px; }
  .customer-header { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 0; }
  .customer-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; }
  .customer-nav a { margin-left: 0; margin-right: 14px; padding: 6px 0; }
  .customer-nav form { margin-left: 0 !important; }

  .card { padding: 14px; }
  .flex-between { align-items: flex-start; }
  .login-card { width: 100%; max-width: 380px; padding: 26px 22px; }

  /* 图片缩略图自适应两列 */
  .thumb-grid img { width: 100px; height: 100px; }
  #preview-grid img { width: 80px; height: 80px; }

  /* 大按钮全宽，好点按 */
  .btn-lg { display: block; width: 100%; text-align: center; margin-bottom: 10px; }
  .kv dt { width: 76px; }
}

@media (max-width: 480px) {
  body { font-size: 13px; }
  .thumb-grid img { width: calc(50vw - 32px); height: calc(50vw - 32px); }
}
.kv { margin: 0; }
.kv div { display: flex; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.kv div:last-child { border-bottom: none; }
.kv dt { width: 90px; color: var(--text-2); flex-shrink: 0; }
.kv dd { margin: 0; word-break: break-all; }
.inline-form { display: inline; }
.version-current { background: #e8efff; }
.section-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
