/* 首页（账本）样式，只作用于 body.home。设计变量、按钮、顶栏、弹窗与表单在 style.css。 */

/* ---------- 顶栏 ---------- */
.home .btn-add-top { min-height: 40px; padding: 0 12px; }

/* 孩子切换：三个固定对象，直接平铺，不用下拉 */
.home .kid-switch { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.home .kid {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0;
  min-height: 46px; padding: 0 8px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text-light); font-family: inherit; cursor: pointer;
}
.home .kid-who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.home .kid-who img { border-radius: 50%; flex: none; }
.home .kid-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home .kid-pend { display: none; font-size: 13px; white-space: nowrap; }
.home .kid.on { background: var(--pending-bg); border-color: var(--deco); color: var(--pending); font-weight: 700; }
.home .avatar-fallback { font-size: 22px; line-height: 1; }

/* 奖金概览：待发放是主角，其余三项作次级数据 */
.home .summary { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 16px 12px; }
.home .summary-label { font-size: 13px; color: var(--text-light); }
.home .summary-big { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; }
.home .summary-big b { font-size: 30px; font-weight: 700; color: var(--pending); line-height: 1.15; }
.home .summary-sub { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 2px 0 0; font-size: 13px; color: var(--text-light); }
.home .summary-sub div { display: flex; gap: 4px; }
.home .summary-sub dd { margin: 0; color: var(--text); font-weight: 600; }

/* ---------- 记录区 ---------- */
.home .ledger { margin-top: 12px; }
.home .ledger-tools { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 6px; }
.home .seg { display: flex; padding: 2px; border-radius: 12px; background: #f3eadc; }
.home .seg button {
  min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: none;
  color: var(--text-light); font-family: inherit; cursor: pointer; white-space: nowrap;
}
.home .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: var(--shadow); }
.home .seg-count { display: none; margin-left: 4px; font-weight: 500; }
.home .tool-actions { display: flex; align-items: center; }
.home .sort-btn select { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.home .sort-label { display: none; }
.home .select-tools { min-height: 44px; }
.home .select-hint { font-size: 14px; color: var(--text-light); }

.home .ledger-body { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.home .ledger-state { padding: 40px 16px; text-align: center; color: var(--text-light); display: grid; justify-items: center; gap: 12px; }
.home .ledger-loading { padding: 6px 14px; }
.home .skeleton-row { height: 46px; margin: 8px 0; border-radius: 8px; background: linear-gradient(90deg, #f6efe4, #fbf7f1, #f6efe4); background-size: 200% 100%; animation: lb-shimmer 1.2s infinite; }
.home .skeleton { display: inline-block; color: transparent; border-radius: 6px; background: #f3eadc; }
@keyframes lb-shimmer { to { background-position: -200% 0; } }

/* 紧凑列表：共享一块表面、细分隔线，不做逐条卡片 */
.home .group-head {
  display: flex; justify-content: space-between; gap: 8px; padding: 7px 14px 6px;
  font-size: 13px; color: var(--text-light); background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.home .row { display: flex; align-items: center; min-height: 62px; padding-left: 14px; border-bottom: 1px solid var(--line); }
.home .row:last-child { border-bottom: 0; }
.home .row.selected { background: #fffbeb; }
.home .row-main {
  flex: 1; min-width: 0; display: grid; gap: 2px; padding: 8px 0; border: 0; background: none;
  text-align: left; color: inherit; font: inherit; cursor: pointer;
}
.home .row-title { display: flex; align-items: center; gap: 4px; min-width: 0; font-weight: 500; }
.home .row-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.home .row-meta { font-size: 14px; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home .row-amt { display: grid; justify-items: end; gap: 3px; padding-left: 8px; }
.home .row-amt b { font-weight: 700; }
.home .row-more { margin-right: 2px; }
.home .attach-badge { flex: none; width: 15px; height: 15px; }
.home .tag { display: inline-block; padding: 0 6px; border-radius: 999px; font-size: 13px; line-height: 19px; white-space: nowrap; }
.home .tag-pending { background: var(--pending-bg); color: var(--pending); }
.home .tag-paid { background: var(--paid-bg); color: var(--paid); }

/* 选择：复选框本体 20px，外层 44px 都可点 */
.home .row-check { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin-left: -12px; cursor: pointer; }
.home .row-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.home .row-check .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid #c9b8a3; display: grid; place-items: center; color: transparent; }
.home .row-check input:checked + .box { background: var(--accent); border-color: var(--accent); color: #fff; }
.home .row-check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.home.selecting .row-amt { padding-right: 14px; }

.home .pay-tray {
  position: fixed; left: 10px; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
  max-width: 560px; margin: 0 auto; min-height: 60px; padding: 0 8px 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #2b2520; color: #fff; border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}
.home .btn-tray { background: #f59e0b; color: #2b2520; }   /* #2b2520 / #f59e0b ≈ 7.0:1 */
.home.selecting .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* 表格（宽屏默认；窄屏可在「更多」里切换，横向滚动） */
.home .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.home .ledger-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.home .ledger-table th {
  padding: 0 12px; height: 42px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  text-align: left; font-size: 13px; font-weight: 600; letter-spacing: .5px; color: var(--text-light); white-space: nowrap;
}
.home .ledger-table td { padding: 0 12px; height: 52px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 15px; }
.home .ledger-table tbody tr:last-child td { border-bottom: 0; }
.home .ledger-table tbody tr:hover td { background: #fffcf6; }
.home .ledger-table tr.selected td { background: #fffbeb; }
.home .th-sort {
  display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; cursor: pointer;
}
.home .th-sort span { font-size: 12px; opacity: .7; }
.home .th-sort.on { color: var(--text); }
.home .c-date { color: var(--text-light); }
.home .c-award { white-space: normal !important; min-width: 12rem; }
.home .cell-link { border: 0; background: none; padding: 6px 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.home .cell-link:hover { color: var(--accent); text-decoration: underline; }
.home .c-award .attach-badge { margin-left: 4px; vertical-align: -2px; }
.home .c-sem { color: var(--text-light); max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
.home .ledger-table .c-amt { text-align: right; font-weight: 700; padding-right: 20px; }
.home .ledger-table th.c-amt .th-sort { flex-direction: row; }
.home .c-status { padding-left: 4px !important; }
.home .paid-on { display: block; font-size: 12px; color: var(--text-light); line-height: 1.2; margin-top: 2px; }
.home .c-act { text-align: right; width: 1%; }
.home .c-check { width: 44px; padding: 0 0 0 6px !important; }
.home .c-check .row-check { margin-left: 0; }

/* 弹出菜单 */
.home .popover-menu {
  position: fixed; z-index: 40; min-width: 168px; padding: 6px; border-radius: 12px;
  background: var(--surface); box-shadow: 0 10px 30px rgba(40, 25, 5, .18), 0 0 0 1px var(--line);
}
.home .popover-menu button {
  display: block; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px;
  background: none; text-align: left; color: var(--text); font-family: inherit; cursor: pointer;
}
.home .popover-menu button:hover, .home .popover-menu button:focus-visible { background: var(--surface-2); }
.home .popover-menu .danger { color: var(--danger); }

/* ---------- 弹窗：记录、导出、发放、预览 ---------- */
/* 记录表单弹窗 - PC 端双栏布局 */
.modal-record {
  max-width: 760px;
}

.modal-record .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

.modal-record .form-column {
  min-width: 0; /* 防止内容撑开列宽 */
}

.modal-record .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-record .form-row .form-group {
  margin-bottom: 12px;
}

/* 记录弹窗按钮不要太大 */
.modal-record .form-actions {
  justify-content: flex-end;
}

.modal-record .form-actions .btn-cancel,
.modal-record .form-actions .btn-save {
  flex: none;
  width: auto;
  padding: 10px 30px;
}

@media (max-width: 700px) {
  .modal-record {
    max-width: 450px;
  }

  .modal-record .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .modal-record .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .modal-record .form-actions {
    justify-content: stretch;
  }

  .modal-record .form-actions .btn-cancel,
  .modal-record .form-actions .btn-save {
    flex: 1;
    padding: 12px;
  }
}

/* Export modal */
.export-content {
  max-width: 600px;
}

.export-hint {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 15px;
}

#exportData {
  width: 100%;
  height: 300px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.85rem;
  resize: none;
}

/* 搜索下拉组件 */
.search-select {
  position: relative;
}

.search-select-input {
  width: 100%;
  padding: 10px 32px 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
}

.search-select-input:focus {
  outline: none;
  border-color: var(--deco);
}

.search-select.open .search-select-input {
  border-radius: 8px 8px 0 0;
  border-color: var(--deco);
  border-bottom-color: var(--border);
}

.search-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--surface);
  border: 2px solid var(--deco);
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 100;
  display: none;
  margin-top: -2px;
}

.search-select.open .search-select-dropdown {
  display: block;
}

.search-select-option {
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-select-option:hover,
.search-select-option.highlighted {
  background: var(--deco-light);
}

.search-select-empty {
  padding: 10px 12px;
  color: var(--text-light);
  font-style: italic;
  text-align: center;
}

/* 发放弹窗提示 */
.pay-hint {
  color: var(--text-light);
  margin-bottom: 15px;
}

/* 附件列表 */
.attachment-list {
  margin-bottom: 10px;
  min-width: 0; /* 防止撑开父容器 */
}

.no-attachments {
  padding: 12px;
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
  background: var(--bg);
  border-radius: 8px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 6px;
  min-width: 0; /* 防止撑开父容器 */
}

.attachment-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.attachment-info {
  flex: 1;
  min-width: 0; /* 关键：允许文本截断 */
  overflow: hidden;
}

.attachment-name {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-meta {
  font-size: 0.75rem;
  color: var(--text-light);
}

.attachment-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-preview, .btn-remove {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: none;
}

.btn-preview {
  background: #dbeafe;
  color: #1d4ed8;
}

.btn-preview:hover {
  background: #bfdbfe;
}

.btn-remove {
  background: #fee2e2;
  color: #dc2626;
}

.btn-remove:hover {
  background: #fecaca;
}

/* 添加附件按钮 */
.attachment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.btn-attach {
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: #4facfe;
  color: white;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-attach:hover {
  background: #bfdbfe;
}

.attachment-hint {
  font-size: 0.7rem;
  color: var(--text-light);
  margin: 0;
  flex-shrink: 1;
  min-width: 0;
}

/* 内联 URL 输入 */
.url-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  min-width: 0; /* 防止撑开父容器 */
}

.url-input {
  flex: 1;
  min-width: 0; /* 允许输入框收缩 */
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
}

.url-input:focus {
  outline: none;
  border-color: var(--deco);
}

.url-input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

.btn-verify {
  padding: 8px 12px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-verify:hover:not(:disabled) {
  border-color: var(--deco);
  color: var(--deco);
}

.btn-verify:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-verify.loading {
  position: relative;
  color: transparent;
}

.btn-verify.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 预览弹窗 */
.modal-preview {
  max-width: 800px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.preview-header h2 {
  margin: 0;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  padding: 0;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text);
}

.preview-body {
  max-height: 60vh;
  overflow: auto;
}

.preview-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.preview-body iframe {
  width: 100%;
  height: 500px;
  border: none;
  border-radius: 8px;
}

.btn-download {
  display: inline-block;
  padding: 10px 20px;
  background: var(--deco);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  margin-top: 15px;
}

.btn-download:hover {
  background: var(--deco-light);
}

/* 智能识别按钮 */
.smart-recognize-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.btn-smart-recognize {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-smart-recognize:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-smart-recognize:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-smart-recognize.loading .recognize-label {
  display: none;
}

.btn-smart-recognize.loading::after {
  content: '识别中...';
}

.smart-recognize-hint {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* 识别状态提示 */
.recognize-status {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.recognize-status.success {
  background: #d1fae5;
  color: #065f46;
}

.recognize-status.error {
  background: #fee2e2;
  color: #dc2626;
}

.recognize-status.info {
  background: #dbeafe;
  color: #1d4ed8;
}

/* 已上传凭证印章图标 */
.attach-badge {
  vertical-align: -0.15em;
  margin-left: 1px;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .smart-recognize-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .btn-smart-recognize {
    width: 100%;
    justify-content: center;
  }
}

/* ---------- 记录弹窗：识别入口 ---------- */
.home .btn-smart-recognize { background: var(--accent); box-shadow: none; min-height: 44px; }
.home .btn-smart-recognize:hover:not(:disabled) { background: #9a4708; transform: none; box-shadow: none; }
.home .btn-smart-recognize .icon { fill: none; stroke: currentColor; }

/* ---------- 对话式识别 ---------- */
.home .ai-card { margin: 0 0 14px; padding: 12px; border: 1px solid #f3e3c8; border-radius: var(--radius); background: var(--surface-2); }
.home .ai-head { display: flex; gap: 12px; align-items: flex-start; }
.home .ai-thumb { flex: none; width: 52px; height: 64px; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); background: #fff; }
.home .ai-main { flex: 1; min-width: 0; }
.home .ai-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }
.home .ai-title::before { margin-right: 6px; color: var(--deco); content: "✳"; }
.home .ai-card[data-state="done"] .ai-title::before { color: var(--paid); content: "✓"; }
.home .ai-card[data-state="fail"] .ai-title::before { color: var(--pending); content: "⚠"; }
.home .ai-card[data-state="done"] .ai-title { color: var(--paid); }
.home .ai-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-light); }
.home .ai-steps { margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; line-height: 1.5; }
.home .ai-step { position: relative; padding-left: 20px; margin-top: 2px; }
.home .ai-step::before { position: absolute; left: 0; top: 0; width: 14px; text-align: center; }
.home .ai-step.done { color: var(--paid); }
.home .ai-step.done::before { content: "✓"; }
.home .ai-step.warn { color: var(--pending); }
.home .ai-step.warn::before { content: "⚠"; }
.home .ai-step.busy { color: var(--text-light); }
.home .ai-step.busy::before {
  content: ""; top: .3em; left: 2px; width: 8px; height: 8px; border: 2px solid var(--deco); border-right-color: transparent;
  border-radius: 50%; animation: ai-spin .8s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

.home .ai-ask { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.home .ai-question { margin: 0 0 10px; font-size: 15px; font-weight: 700; line-height: 1.45; color: var(--text); }
.home .ai-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.home .ai-chip {
  min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font-family: inherit; cursor: pointer;
}
.home .ai-chip:hover { border-color: var(--deco); background: var(--pending-bg); }
.home .ai-other { display: flex; gap: 8px; margin-top: 10px; }
.home .ai-other input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; }
.home .ai-answer-btn { flex: none; min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-family: inherit; cursor: pointer; }
.home .ai-ask-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; color: var(--text-light); }
.home .ai-ask-foot .link-btn { min-height: 36px; padding: 0 2px; font-size: 13px; }

.home .ai-form-peek {
  display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 44px; margin: 0 0 14px; padding: 0 12px;
  border: 1px dashed var(--border); border-radius: 12px; background: none; color: var(--text-light); font-family: inherit; cursor: pointer;
}
.home .ai-peek-toggle { color: var(--text); }
.home .ai-asking:not(.ai-form-open) .form-grid { display: none; }

/* AI 填的字段：标签后加「AI」，用户一改就去掉 */
.home .ai-filled > label::after {
  content: "AI"; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--pending-bg); color: var(--pending);
  font-size: 11px; font-weight: 700; vertical-align: 1px;
}
.home .ai-filled input, .home .ai-filled select, .home .ai-filled textarea { border-color: #f1cf98; background: #fffcf6; }
.home .ai-basis { margin: -4px 0 12px; font-size: 13px; line-height: 1.5; color: var(--text-light); }

.home .ai-dup { margin: 4px 0 12px; padding: 10px 12px; border: 1px solid #fed7aa; border-radius: 12px; background: #fff7ed; font-size: 14px; color: var(--pending); }
.home .ai-dup-title { margin: 0 0 4px; font-weight: 700; }
.home .ai-dup-title::before { content: "⚠"; margin-right: 6px; }
.home .ai-dup-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; color: var(--text); }
.home .ai-dup-open { min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--accent); font-family: inherit; cursor: pointer; }
.home .ai-dup-hint { margin: 6px 0 0; font-size: 13px; }

@media (min-width: 900px) {
  .home .ai-form-peek { display: none; }
  .home .ai-asking:not(.ai-form-open) .form-grid { display: grid; }
  /* 提问时两栏：左边对话，右边表单 */
  .home .modal-record.ai-asking { max-width: 960px; }
  .home .ai-asking #recordForm { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; align-items: start; }
  .home .ai-asking #recordForm > * { grid-column: 1 / -1; }
  .home .ai-asking #recordForm > .ai-card { grid-column: 1; }
  .home .ai-asking #recordForm > .form-grid { grid-column: 2; grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .home .ai-step.busy::before { animation: none; }
}

/* ---------- 宽屏 ---------- */
@media (min-width: 900px) {
  .home .kid-switch { grid-template-columns: repeat(auto-fill, minmax(220px, 260px)); gap: 8px; }
  .home .kid { justify-content: space-between; padding: 0 14px; min-height: 50px; }
  .home .kid-pend { display: inline; font-weight: 500; }
  .home .seg-count { display: inline; }
  .home .sort-btn { display: none; }   /* 宽屏用表头排序 */
  .home .ledger-tools { margin-bottom: 8px; }
  .home .btn-add-top { min-height: 44px; padding: 0 16px; }
  .home .btn-add-top span::before { content: '添加'; }
}
@media (prefers-reduced-motion: reduce) {
  .home .skeleton-row { animation: none; }
}

/* ---------- 奖励统计图 ---------- */
.home .summary { position: relative; }
.home .chart-open { position: absolute; top: 6px; right: 6px; color: var(--accent); }
.home .chart-card { display: none; }
.home .chart-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }
.home .seg-sm { padding: 2px; border-radius: 10px; }
.home .seg-sm button { min-height: 36px; padding: 0 9px; font-size: 13px; border-radius: 8px; }
.home .chart-empty { margin: 0; padding: 16px 0; text-align: center; color: var(--text-light); font-size: 14px; }
.home .kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 10px; }
.home .kpi { background: var(--surface-2); border-radius: 10px; padding: 6px 10px 7px; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
.home .kpi-label { width: 100%; font-size: 12px; color: var(--text-light); }
.home .kpi b { font-size: 22px; font-weight: 700; line-height: 1.2; }
.home .kpi-prev { font-size: 12px; color: var(--text-light); }   /* 对比只陈述数字，不用红绿暗示好坏 */
.home .combo { --cc-bar: var(--deco); --cc-line: #7c4a1e; }
.home .cc-legend { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-light); }
.home .chart-group { margin-left: auto; padding: 2px; border-radius: 8px; }
.home .chart-group button { min-height: 28px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.home .cc-legend i { display: inline-block; margin-right: 5px; vertical-align: middle; }
.home .lg-bar { width: 10px; height: 10px; border-radius: 3px; background: var(--cc-bar); }
.home .lg-line { width: 14px; height: 0; border-top: 2px solid var(--cc-line); position: relative; }
.home .lg-line::after { content: ""; position: absolute; left: 4px; top: -4px; width: 6px; height: 6px; border-radius: 50%; background: var(--cc-line); }
.home .cc-row { display: flex; }
.home .cc-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; position: relative; }
.home .cc-amts { margin-top: 6px; }
.home .cc-amt { font-size: 10.5px; height: 14px; white-space: nowrap; color: var(--text); }
.home .cc-plot { position: relative; }
.home .cc-plot > * { position: absolute; inset: 0; }
.home .cc-plot svg { width: 100%; height: 100%; overflow: visible; }
.home .cc-plot polyline { fill: none; stroke: var(--cc-line); stroke-width: 1.8; stroke-linejoin: round; }
.home .cc-bars .cc-col { justify-content: flex-end; }
.home .cc-track { height: 100%; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.home .cc-track i { display: block; width: min(60%, 26px); border-radius: 4px 4px 1px 1px; background: var(--cc-bar); }
.home .cc-dot { position: absolute; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--cc-line); box-shadow: 0 0 0 2px var(--surface); }
.home .cc-dot span {
  position: absolute; left: 7px; bottom: 4px; font-size: 11px; font-weight: 700; color: var(--cc-line); white-space: nowrap;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff, 0 0 3px #fff;   /* 白色描边：压在柱子上也清楚 */
}
.home .cc-axis { border-top: 1px solid var(--border); padding-top: 3px; }
.home .cc-x { font-size: 11px; color: var(--text-light); white-space: nowrap; }
.home .cc-col.future .cc-x { opacity: .5; }
.home .chart-body-lg .cc-amt, .home .chart-body-lg .cc-dot span { font-size: 12px; }
.home .chart-body-lg .kpi b { font-size: 26px; }

/* 窄屏：弹窗 */
.home .chart-modal { max-width: 560px; padding: 16px 16px 20px; }
.home .chart-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.home .chart-modal-head h2 { margin: 6px 0 0; font-size: 17px; }
.home .chart-modal .chart-range { margin-bottom: 4px; width: fit-content; }

@media (min-width: 900px) {
  /* 概览收窄成左侧一栏，图表占剩余宽度；概览内容上下铺满，和图表卡同高时不留大块空白 */
  .home .overview { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; align-items: stretch; }
  .home .chart-open { display: none; }
  .home .summary { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 14px 18px; }
  .home .summary-big { flex-direction: column; align-items: flex-start; row-gap: 0; }
  .home .summary-big b { font-size: 40px; }
  .home .summary-sub { display: grid; grid-template-columns: 1fr; gap: 6px; font-size: 14px; }
  .home .summary-sub div { justify-content: space-between; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); }
  .home .chart-card { display: block; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px 6px; }
  .home .chart-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
}
