/* =========================================================
 * 个人生涯管控台 全局样式
 *  - 首页仪表盘（Dashboard）
 *  - 详情子页面（Section Page）
 *  - 读后感子页面（Reading Note）
 * ========================================================= */

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

:root {
  --color-primary: #2c7be5;
  --color-primary-light: #e7f1ff;
  --color-danger: #e74c3c;
  --color-success: #18b36a;
  --color-warn: #f39c12;
  --color-bg: #f5f7fa;
  --color-card: #ffffff;
  --color-border: #e4e7eb;
  --color-text: #2d3748;
  --color-text-light: #718096;
  --color-sidebar: #1a2233;
  --color-sidebar-active: #2c7be5;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 20px rgba(44, 123, 229, 0.18);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 13px;
  transition: all 0.15s ease;
}

input, textarea, select {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease;
  background: #fff;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--color-primary);
}

textarea {
  resize: vertical;
  min-height: 80px;
  width: 100%;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

/* ====== 顶栏 ====== */
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar .title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
}

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

/* ====== 仪表盘布局 ====== */
.dashboard {
  padding: 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 1024px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .cards-grid { grid-template-columns: 1fr; }
}

/* ====== 板块大卡片 ====== */
.section-card {
  background: var(--color-card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px 24px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  border: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.section-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-primary);
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.section-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--color-primary);
}

.section-card:hover::before { opacity: 1; }

.section-card .card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-card .card-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-card .card-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
}

.section-card .card-stats {
  display: flex;
  gap: 18px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-card .stat-item {
  display: flex;
  flex-direction: column;
}

.section-card .stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.section-card .stat-label {
  font-size: 12px;
  color: var(--color-text-light);
}

.section-card .latest-preview {
  background: #f7fafc;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 14px;
  min-height: 42px;
  border-left: 3px solid var(--color-primary);
}

.section-card .latest-preview .preview-label {
  font-size: 11px;
  color: var(--color-text-light);
  display: block;
  margin-bottom: 2px;
}

.section-card .latest-preview .preview-text {
  word-break: break-all;
}

.section-card .card-footer {
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
}

.section-card .card-footer .arrow {
  transition: transform 0.2s ease;
}

.section-card:hover .card-footer .arrow {
  transform: translateX(4px);
}

/* ====== 卡片定制化样式（6 板块差异化展示） ====== */
.card-block {
  margin-bottom: 14px;
}
.card-block:last-of-type { margin-bottom: 0; }

.block-label {
  font-size: 11px;
  color: var(--color-text-light);
  font-weight: 500;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.block-label .badge {
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
}

/* 滚动列表（用于待办/持仓/计划等条目较多的场景） */
.scroll-list {
  max-height: 140px;
  overflow-y: auto;
  background: #f7fafc;
  border-radius: 8px;
  padding: 6px 10px;
  border-left: 3px solid var(--color-primary);
}

.scroll-list::-webkit-scrollbar { width: 6px; }
.scroll-list::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}
.scroll-list::-webkit-scrollbar-track { background: transparent; }

.list-item {
  font-size: 13px;
  color: var(--color-text);
  padding: 4px 0;
  border-bottom: 1px dashed #e4e7eb;
  display: flex;
  align-items: center;
  gap: 6px;
}
.list-item:last-child { border-bottom: none; }

.list-item .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}
.list-item .dot.success { background: var(--color-success); }
.list-item .dot.warn { background: var(--color-warn); }
.list-item .dot.danger { background: var(--color-danger); }

.list-item .text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .meta {
  font-size: 11px;
  color: var(--color-text-light);
  flex-shrink: 0;
}

.list-item .heart {
  color: var(--color-danger);
  font-size: 12px;
  flex-shrink: 0;
}

/* 单行截断 */
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 双行截断 */
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

/* 双列布局（家庭育儿 - 已废弃，保留兼容） */
.dual-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dual-col .col-box {
  background: #f7fafc;
  border-radius: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--color-primary);
}

.dual-col .col-box.girl {
  border-left-color: #ec407a;
}

.dual-col .col-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}

.dual-col .col-list {
  max-height: 120px;
  overflow-y: auto;
}
.dual-col .col-list::-webkit-scrollbar { width: 4px; }
.dual-col .col-list::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 2px;
}

/* 上下分栏布局（家庭育儿新版） */
.vertical-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}
.vertical-stack::-webkit-scrollbar { width: 6px; }
.vertical-stack::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}
.vertical-stack::-webkit-scrollbar-track { background: transparent; }

.stack-box {
  background: #f7fafc;
  border-radius: 8px;
  padding: 10px 12px;
  border-left: 3px solid var(--color-primary);
}

.stack-box.girl {
  border-left-color: #ec407a;
}

.stack-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 截图识别上传按钮（投资理财） */
.ocr-btn-wrap {
  position: relative;
  display: inline-block;
}

.ocr-loading {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  white-space: nowrap;
}

.ocr-loading.show { display: block; }
.ocr-loading .progress {
  width: 180px;
  height: 4px;
  background: #e4e7eb;
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.ocr-loading .progress-bar {
  height: 100%;
  background: var(--color-primary);
  width: 0;
  transition: width 0.2s ease;
}

/* 截图识别结果预览 */
.ocr-preview-list {
  margin: 8px 0;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #f7fafc;
}

.ocr-preview-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  display: grid;
  grid-template-columns: auto 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}
.ocr-preview-item:last-child { border-bottom: none; }
.ocr-preview-item input {
  padding: 4px 6px;
  font-size: 12px;
}

/* 健康问题独立页面 */
.health-page {
  max-width: 960px;
  margin: 40px auto;
  padding: 0 24px;
}

.health-page .page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.health-page .page-title {
  font-size: 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.health-issue-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 16px;
  border-left: 4px solid var(--color-warn);
}

.health-issue-card .issue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.health-issue-card .issue-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.health-issue-card .issue-meta {
  font-size: 12px;
  color: var(--color-text-light);
}

.health-issue-card .issue-section {
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.health-issue-card .issue-section .label {
  font-weight: 600;
  color: var(--color-text);
  margin-right: 4px;
}

.health-issue-card .advice-block {
  background: #f0f7ff;
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 6px;
  border-left: 3px solid var(--color-primary);
}

.health-issue-card .advice-block .label {
  color: var(--color-primary);
}

.health-issue-card .actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}

/* 健康卡片可点击跳转区域 */
.health-clickable {
  cursor: pointer;
  transition: background 0.15s ease;
  border-radius: 8px;
  padding: 4px;
  margin: -4px;
}
.health-clickable:hover {
  background: var(--color-primary-light);
}
.health-clickable:hover .block-label .badge {
  background: #fff;
}

/* 资产对比切换器（家庭生活） */
.asset-summary {
  background: #f7fafc;
  border-radius: 8px;
  padding: 10px 12px;
  border-left: 3px solid var(--color-primary);
  margin-bottom: 10px;
}

.asset-toggle {
  display: inline-flex;
  background: #e4e7eb;
  border-radius: 6px;
  padding: 2px;
  margin-bottom: 8px;
}

.asset-toggle button {
  border: none;
  background: transparent;
  color: var(--color-text-light);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.asset-toggle button.active {
  background: #fff;
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.asset-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.asset-delta {
  font-size: 12px;
  margin-top: 4px;
}

.asset-delta.up { color: var(--color-success); }
.asset-delta.down { color: var(--color-danger); }
.asset-delta.flat { color: var(--color-text-light); }

.asset-link {
  font-size: 11px;
  color: var(--color-primary);
  margin-top: 6px;
  display: inline-block;
  cursor: pointer;
}
.asset-link:hover { text-decoration: underline; }

/* 卡片内空数据提示 */
.empty-inline {
  font-size: 12px;
  color: var(--color-text-light);
  padding: 8px 10px;
  text-align: center;
}

/* ====== 提示条 ====== */
.section-tip {
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 20px;
  background: #fffaf0;
  border: 1px dashed var(--color-warn);
  padding: 8px 12px;
  border-radius: var(--radius);
}

/* ====== 详情子页面布局 ====== */
.section-page {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.section-page .page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.section-page .page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 600;
}

.section-page .page-title .icon {
  font-size: 26px;
}

/* ====== Tab 切换 ====== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab {
  padding: 10px 18px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--color-text-light);
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
}

.tab:hover { color: var(--color-primary); }

.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 500;
}

.panel { display: none; }
.panel.active { display: block; }

/* ====== 板块卡片 ====== */
.card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ====== 表格 ====== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

th {
  background: #f7fafc;
  font-weight: 600;
  color: var(--color-text);
  position: sticky;
  top: 0;
}

td { color: var(--color-text); }

tr:last-child td { border-bottom: none; }

tr:hover td { background: #fafbfc; }

td.editable { cursor: text; }
td.editable:hover { background: #fff8e1; }

td.actions-cell { white-space: nowrap; }

/* ====== 按钮 ====== */
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: #1a68d4; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #138a52; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-warn { background: var(--color-warn); color: #fff; }
.btn-warn:hover { background: #d68910; }
.btn-ghost {
  background: #fff;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover {
  background: #f7fafc;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link {
  background: transparent;
  color: var(--color-primary);
  padding: 2px 6px;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--color-danger); }

/* ====== 弹窗 ====== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-mask.show { display: flex; }

.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 520px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title { font-size: 15px; font-weight: 600; }

.modal-close {
  background: transparent;
  color: var(--color-text-light);
  font-size: 18px;
  padding: 0 6px;
}

.modal-body { padding: 20px; }
.modal-body .form-row { margin-bottom: 12px; }

.modal-body label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--color-text-light);
}

.modal-body input,
.modal-body select,
.modal-body textarea { width: 100%; }

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ====== Toast ====== */
.toast {
  position: fixed;
  top: 70px;
  right: 24px;
  background: var(--color-text);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  z-index: 2000;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-danger); }
.toast.warn { background: var(--color-warn); }

/* ====== 读书清单特殊样式 ====== */
.reading-row { cursor: pointer; }

.reading-row .heart {
  color: var(--color-danger);
  font-size: 14px;
  margin-left: 6px;
}

.reading-row.finished { background: #fff8fa; }
.reading-row.finished:hover td { background: #fff0f5; }

/* ====== 空数据 ====== */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-light);
  font-size: 13px;
}

/* ====== 读后感子页面 ====== */
.note-page {
  max-width: 820px;
  margin: 40px auto;
  padding: 0 24px;
}

.note-page .note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.note-page h2 { font-size: 22px; font-weight: 600; }

.note-meta {
  color: var(--color-text-light);
  font-size: 13px;
  margin-bottom: 16px;
}

.note-textarea {
  min-height: 360px;
  font-size: 15px;
  line-height: 1.8;
  padding: 14px;
}

.note-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

/* ====== 通用辅助 ====== */
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warn { color: var(--color-warn); }
.text-muted { color: var(--color-text-light); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.tag.danger { background: #fdecea; color: var(--color-danger); }
.tag.success { background: #e6f8f0; color: var(--color-success); }
.tag.warn { background: #fef5e7; color: var(--color-warn); }

@media (max-width: 768px) {
  .topbar .title { font-size: 16px; }
  .section-page { padding: 16px; }
}
