/* ========================================================================
   芯美丽格·盘客 - 1:1 复刻小程序 WXSS
   1rpx = 1px (iPhone 6 设计稿换算)
   投屏场景下也保持同款，电视距离大字号自动适配
   ======================================================================== */

:root {
  --purple: #9B7BB8;
  --purple-light: #F3EFFF;
  --purple-border: #C9B8DC;
  --text-primary: #333333;
  --text-secondary: #888888;
  --text-placeholder: #b3aea1;
  --bg-page: #ffffff;
  --bg-photo-empty: #4a4458;
  --search-bg: #f5f5f5;
  --border-light: #f0e8f5;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 26px;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; outline: none; }

.hidden { display: none !important; }
.loading { padding: 80px 20px; text-align: center; color: var(--text-placeholder); font-size: 26px; }
.empty-state { padding: 100px 20px; text-align: center; }
.empty-icon { font-size: 80px; margin-bottom: 16px; opacity: 0.4; }
.empty-text { font-size: 26px; color: var(--text-placeholder); }

.toast {
  position: fixed; top: 60px; left: 50%;
  transform: translateX(-50%);
  padding: 16px 32px;
  background: rgba(0,0,0,0.78); color: #fff;
  font-size: 26px; border-radius: 8px;
  z-index: 99999; opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }
.toast.error { background: rgba(200,60,60,0.92); }
.toast.success { background: rgba(60,150,90,0.92); }

/* ========================================================================
   页面容器
   ======================================================================== */
.page-wrap { min-height: 100vh; background: var(--bg-page); }
@media (min-width: 1200px) {
  .page-wrap { max-width: 1280px; margin: 0 auto; }
}

/* ========================================================================
   顶栏 - 与小程序一致
   padding: 44px 24px 0 24px; height: calc(88px + 44px); background: #9B7BB8
   ======================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 24px 0 24px;
  height: 88px;
  background: var(--purple);
  position: sticky; top: 0; z-index: 100;
}
.topbar-spacer { flex: 1; flex-shrink: 0; }
.topbar-mine {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 24px;
  border: none;
  cursor: pointer;
  padding: 0;
}
.topbar-mine-icon { font-size: 30px; line-height: 1; }

/* 详情页顶栏 */
.detail-topbar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 88px;
  background: var(--purple);
  position: sticky; top: 0; z-index: 100;
}
.home-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 56px; padding: 0 24px 0 16px;
  border-radius: 32px;
  background: #fff; border: none;
  cursor: pointer; flex-shrink: 0;
  margin-right: auto;
}
.back-text { color: var(--purple); font-size: 26px; font-weight: 500; line-height: 1; }
.back-arrow-icon {
  width: 16px; height: 16px;
  border-left: 3px solid var(--purple);
  border-bottom: 3px solid var(--purple);
  transform: rotate(45deg);
  margin-left: 4px;
}
.detail-title {
  font-size: 28px; font-weight: 600; color: #fff;
  letter-spacing: 2px; flex: 1;
}

/* ========================================================================
   筛选 + 搜索 + 新建 - 与小程序完全一致
   height: 56px; padding: 0 24px; border-radius: 32px
   ======================================================================== */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px;
  background: var(--bg-page);
}
.date-chip {
  flex-shrink: 0; display: inline-flex; cursor: pointer; position: relative;
}
.date-chip-inner {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--purple-light);
  border: 1px solid var(--purple-border);
  border-radius: 32px;
  padding: 0 24px;
  height: 56px;
  white-space: nowrap;
}
.date-chip-text {
  font-size: 26px; font-weight: 500;
  white-space: nowrap;
}
.date-placeholder { color: var(--purple); }
.date-active { color: var(--purple); font-weight: 700; }
.date-chip-clear {
  font-size: 30px; color: var(--purple);
  font-weight: 400; padding-left: 4px; line-height: 1; cursor: pointer;
}
.date-input-hidden { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.search-box {
  flex: 1; min-width: 0;
  display: flex; align-items: center;
  background: var(--search-bg);
  border-radius: 32px;
  padding: 0 24px;
  height: 56px;
}
.search-icon {
  font-size: 30px; color: var(--text-secondary);
  margin-right: 12px;
}
.search-input {
  flex: 1;
  font-size: 26px; color: var(--text-primary);
  background: transparent; border: none; outline: none;
}
.search-input::placeholder { color: var(--text-placeholder); }
.new-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  height: 56px;
  padding: 0 24px;
  background: var(--purple);
  color: #fff;
  font-size: 26px; font-weight: 700;
  border-radius: 32px;
  white-space: nowrap;
  border: none; cursor: pointer;
}
.empty-hint {
  display: flex; align-items: center; justify-content: center;
  padding: 100px 20px;
}
.empty-hint-text { font-size: 26px; color: var(--text-placeholder); text-align: center; }

/* ========================================================================
   卡片列表
   ======================================================================== */
.card-list {
  padding: 16px 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
/* 桌面 / 投屏：2 列；手机（<900px）：1 列 */
@media (min-width: 900px) {
  .card-list { grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 20px 24px; }
}

/* ========================================================================
   客户卡片 - 1:1 复刻小程序
   照片在右侧 218x290，紫色面板 20% 宽度
   ======================================================================== */
.cust-card {
  position: relative;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  cursor: pointer;
  border: 1px solid var(--border-light);
}
.cust-card:hover {
  box-shadow: 0 4px 16px rgba(155,123,184,0.15);
}

/* 右侧紫面板 */
.cc-blue-panel {
  position: absolute;
  top: 0; right: 0;
  width: 130px; height: 100%;
  background: #F3EFFF;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 20px;
  z-index: 1;
}

.cc-photo-area {
  width: 200px; height: 268px;
  display: flex; align-items: center; justify-content: center;
  z-index: 3;
}
.cc-photo-wrap {
  width: 200px; height: 268px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.10);
}
.cc-photo {
  width: 100%; height: 100%;
  display: block; object-fit: cover;
}
.cc-photo-empty {
  width: 200px; height: 268px;
  border-radius: 10px;
  background: #F8F4FF;
  border: 2px dashed #C9B8DC;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
}
.cc-photo-empty-text { font-size: 22px; color: #888888; font-weight: 500; }

/* 左侧文字区 */
.cc-main {
  flex: 1; min-width: 0;
  padding: 18px 240px 18px 28px;
  background: #ffffff;
}
.cc-name-wrap { display: inline-block; margin-bottom: 14px; }
.cc-name {
  font-size: 32px; font-weight: 600; color: #333333;
  line-height: 1.3; white-space: nowrap; display: block;
}
.cc-name-v { color: #333333; font-weight: 600; }
.cc-line-long {
  width: 100%; height: 2px;
  background: #9B7BB8;
  margin-top: 12px;
}
.cc-line-text {
  display: block;
  font-size: 22px; line-height: 1.7;
  margin-bottom: 10px;
}
.cc-label {
  font-size: 24px; color: #888888;
  white-space: nowrap; flex-shrink: 0;
  margin-right: 4px; display: inline; line-height: 1.7;
}
.cc-value {
  font-size: 24px; color: #333333;
  word-break: break-all; display: inline; line-height: 1.7;
}
.cc-money { font-weight: 600; color: #333333; }
.cc-line-short {
  width: 50px; height: 9px;
  background: #9B7BB8;
  margin: 16px 0 20px;
  border-radius: 3px;
  flex-shrink: 0; align-self: flex-start; display: block;
}
.cc-section { display: block; }
.cc-h {
  font-size: 24px; font-weight: 600; color: #888888;
  margin-bottom: 8px; display: block; line-height: 1.7;
}
.cc-text {
  font-size: 24px; color: #333333;
  line-height: 1.7; white-space: pre-wrap; word-break: break-all;
  display: block; width: 100%;
}
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================================================
   详情页
   ======================================================================== */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 24px;
}
@media (min-width: 1200px) {
  .detail-layout { grid-template-columns: 1fr 360px; gap: 32px; }
}
.detail-content-col { display: flex; flex-direction: column; gap: 20px; }


/* 章节 */
.section {
  background: var(--bg-page);
  border-radius: 8px;
  padding: 24px 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid var(--border-light);
}
.section-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.section-title {
  font-size: 28px; font-weight: 700; color: var(--text-primary);
  letter-spacing: 0.5px;
}
.section-amount {
  margin-left: auto;
  font-size: 28px; font-weight: 700; color: var(--purple);
}
.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  font-size: 22px; color: var(--text-secondary);
  margin-bottom: 6px;
}
.field-value {
  font-size: 26px; color: var(--text-primary);
  line-height: 1.7; white-space: pre-wrap; word-break: break-all;
}
.field-empty {
  font-size: 24px; color: var(--purple);
  border: 1px dashed var(--purple-border);
  border-radius: 4px; padding: 16px 20px;
  background: var(--purple-light);
  text-align: center;
}

.proj-list { display: flex; flex-direction: column; }
.proj-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 26px;
}
.proj-row:last-child { border-bottom: none; }
.proj-name { flex: 1; min-width: 0; color: var(--text-primary); font-weight: 500; }
.proj-meta { display: flex; align-items: baseline; gap: 16px; flex-shrink: 0; }
.proj-amt { font-size: 26px; color: var(--purple); font-weight: 700; }
.proj-date { font-size: 22px; color: var(--text-secondary); }

/* ========================================================================
   我的页
   ======================================================================== */
.mine-page { background: var(--bg-page); min-height: 100vh; }
.mine-topbar {
  background: var(--purple);
  padding: 24px 24px 0 24px;
  height: 88px;
  display: flex; align-items: center; justify-content: space-between;
  color: #fff;
}
.mine-topbar-back {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  color: var(--purple); font-size: 32px; line-height: 1;
}
.mine-topbar-title { font-size: 28px; font-weight: 600; color: #fff; letter-spacing: 2px; }
.mine-topbar-spacer { width: 56px; }

.mine-content {
  max-width: 600px;
  margin: 20px auto;
  padding: 0 20px;
}

.profile-card {
  display: flex; align-items: center; gap: 20px;
  padding: 24px 20px;
  background: var(--bg-page);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
}
.profile-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--purple); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 600;
  flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name-text {
  font-size: 30px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 6px;
}
.profile-role {
  display: inline-block;
  padding: 4px 12px;
  background: var(--purple-light); color: var(--purple);
  font-size: 22px; font-weight: 600; border-radius: 4px;
}
.first-login-banner {
  margin-bottom: 16px;
  padding: 16px 20px;
  background: var(--purple-light);
  border: 1px solid var(--purple-border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.first-login-text { font-size: 24px; color: var(--text-primary); font-weight: 500; flex: 1; }
.first-login-btn {
  padding: 10px 20px;
  background: var(--purple); color: #fff;
  font-size: 24px; font-weight: 600;
  border: none; border-radius: 32px; cursor: pointer;
  white-space: nowrap;
}

.menu-list {
  background: var(--bg-page);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid var(--border-light);
}
.menu-item {
  display: flex; align-items: center; gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer; background: var(--bg-page);
  width: 100%; text-align: left;
  font-size: 26px; font-weight: 500;
  font-family: inherit; color: var(--text-primary);
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--purple-light); }
.menu-icon { font-size: 28px; flex-shrink: 0; }
.menu-text { flex: 1; }
.menu-arrow { color: var(--text-placeholder); font-size: 28px; }

/* ========================================================================
   登录页
   ======================================================================== */
.login-page {
  min-height: 100vh;
  background: var(--bg-page);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.login-card {
  width: 100%; max-width: 520px;
  background: var(--bg-page);
  border-radius: 8px;
  padding: 48px 40px 40px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border: 1px solid var(--border-light);
}
.login-hero { text-align: center; margin-bottom: 36px; }
.brand-name {
  font-size: 48px; font-weight: 700; color: var(--purple);
  letter-spacing: 2px; margin-bottom: 8px;
}
.brand-subtitle { font-size: 24px; color: var(--text-secondary); letter-spacing: 1px; }
.card-title { font-size: 28px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.card-sub { font-size: 22px; color: var(--text-secondary); margin-bottom: 28px; }
.form-item { margin-bottom: 20px; }
.form-item-label {
  font-size: 22px; color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 8px; display: block;
}
.form-input {
  width: 100%; height: 64px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0 16px;
  font-size: 26px; color: var(--text-primary);
  background: var(--bg-page);
  font-family: inherit; box-sizing: border-box;
}
.form-input:focus { border-color: var(--purple); }
.form-input::placeholder { color: var(--text-placeholder); }
.login-btn {
  width: 100%; height: 64px;
  background: var(--purple); color: #fff;
  font-size: 28px; font-weight: 600; letter-spacing: 4px;
  border: none; border-radius: 32px;
  cursor: pointer; margin-top: 12px; font-family: inherit;
}
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.card-foot { text-align: center; font-size: 20px; color: var(--text-placeholder); margin-top: 24px; }

/* ========================================================================
   通用模态框（编辑/新建/照片库）
   ======================================================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.45);
  padding: 24px; box-sizing: border-box;
}
.modal-box {
  width: 100%; max-width: 780px;
  background: #fff; border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 90vh;
}
.modal-title {
  font-size: 30px; font-weight: 600; color: var(--text-primary);
  padding: 24px 24px 12px;
}
.modal-body { padding: 8px 24px 16px; overflow-y: auto; }
.modal-actions {
  display: flex; gap: 12px;
  padding: 16px 24px 24px;
}
.modal-btn {
  flex: 1; height: 64px;
  border: none; border-radius: 32px;
  font-size: 26px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.modal-btn.cancel { background: #f0f0f0; color: #666; }
.modal-btn.confirm { background: var(--purple); color: #fff; }
.modal-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-field { margin-bottom: 16px; }
.modal-field-label { font-size: 22px; color: var(--text-secondary); margin-bottom: 6px; }
.modal-input, .modal-textarea, .modal-select {
  width: 100%; box-sizing: border-box;
  border: 1px solid #e0e0e0; border-radius: 8px;
  padding: 0 16px; font-size: 26px; color: var(--text-primary);
  background: var(--bg-page); font-family: inherit;
  min-height: 64px;
}
.modal-input:focus, .modal-textarea:focus, .modal-select:focus { border-color: var(--purple); }
.modal-textarea { padding: 18px 20px; line-height: 1.6; resize: vertical; min-height: 400px; font-size: 26px; }
.modal-input::placeholder, .modal-textarea::placeholder { color: var(--text-placeholder); }

/* 照片库 */
.photo-lib-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px; padding: 8px 0;
}
.photo-lib-item {
  position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  background: #f0f0f0; cursor: pointer;
}
.photo-lib-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-lib-del {
  position: absolute; top: 6px; right: 6px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff; border: none;
  font-size: 22px; line-height: 1; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}
.photo-lib-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed #C9B8DC; border-radius: 8px; color: var(--purple);
  font-size: 22px; cursor: pointer; gap: 6px;
}
.photo-lib-add:hover { background: #F8F4FF; }
.photo-lib-empty { text-align: center; color: var(--text-placeholder); padding: 24px; font-size: 24px; }

/* 详情页照片区（section 内） */
.photo-gallery {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px;
}
.photo-gallery-item {
  position: relative; width: 140px; height: 140px; border-radius: 8px;
  overflow: hidden; background: #f0f0f0; cursor: pointer;
}
.photo-gallery-item img { width: 100%; height: 100%; object-fit: cover; }

/* 大图查看 */
.lightbox {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
}
.lightbox img { max-width: 90vw; max-height: 86vh; border-radius: 6px; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.18); color: #fff; font-size: 30px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }
.lightbox-close {
  position: absolute; top: 24px; right: 24px;
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.18); color: #fff; font-size: 28px; cursor: pointer;
}

/* 可编辑字段提示 */
.field.editable { cursor: pointer; border-radius: 6px; transition: background .15s; margin: -4px; padding: 4px; }
.field.editable:hover { background: #F8F4FF; }
.field.editable .field-empty:hover { color: var(--purple); }
.section-add-btn {
  background: var(--purple); color: #fff; border: none;
  border-radius: 20px; padding: 8px 18px; font-size: 20px; cursor: pointer;
  font-family: inherit;
}
.section-add-btn:hover { opacity: 0.9; }
.editable { cursor: pointer; }
.cc-name-wrap.editable:hover, .cc-line-text.editable:hover, .cc-section.editable:hover { opacity: 0.75; }
