/* 组件样式：卡片 / 列表 / 徽章 / 弹窗 / 表单 / 统计 / 隐私空间 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.99); }
.list-item { display: flex; gap: 10px; align-items: flex-start; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.item-title.done { text-decoration: line-through; color: var(--dim); }
.item-sub { color: var(--dim); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 12px;
  white-space: nowrap;
}
.overdue-text { color: var(--danger); }
.muted { color: var(--dim); }

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--dim);
  font-size: 13px;
}
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.btn { padding: 9px 18px; border-radius: 10px; font-size: 14px; background: var(--input-bg); border: 1px solid var(--border); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; text-align: left; padding: 10px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; font-size: 14px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--dim);
  flex: none;
}
.icon-btn:hover { background: var(--input-bg); color: var(--text); }
.icon-btn.small { width: 28px; height: 28px; }
.icon-btn.danger:hover { color: var(--danger); }

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 弹窗（底部抽屉样式，宽屏居中） */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
}
.dialog {
  background: var(--bg-soft);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
@media (min-width: 600px) {
  .dialog-overlay { align-items: center; padding: 24px; }
  .dialog { border-radius: 16px; }
}
.dialog-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.dialog-actions .btn { flex: none; }
.confirm-msg { margin: 4px 0; line-height: 1.6; }

.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 5px; }
.field-hint { display: block; font-size: 12px; color: var(--dim); margin-top: 4px; }
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row > * { flex: 1; }
.field-row .icon-btn { flex: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 14px;
  max-width: 86vw;
  z-index: 120;
  pointer-events: none;
}
.toast.warn { border-color: var(--warn); }
.toast.error { border-color: var(--danger); }

.section-title {
  font-size: 14px;
  color: var(--dim);
  font-weight: 600;
  margin: 14px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.empty { text-align: center; color: var(--dim); padding: 30px 0; font-size: 14px; }

.tag-editor .tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
}
.tag-x { color: inherit; font-size: 14px; padding: 0 2px; }

.mic-wrap { position: relative; }
.mic-wrap textarea { padding-bottom: 42px; }
.mic-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--dim);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mic-btn.mic-on { color: #fff; background: var(--danger); border-color: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .7; } }

/* 统计 */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.kpi-num { font-size: 26px; font-weight: 700; }
.kpi-label { color: var(--dim); font-size: 13px; }
.hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.hbar-label { width: 96px; flex: none; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { flex: 1; background: var(--input-bg); border-radius: 6px; height: 12px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 6px; }
.hbar-num { width: 28px; text-align: right; color: var(--dim); flex: none; }
.vbar-chart { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 8px; margin-bottom: 4px; }
.vbar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.vbar { width: 100%; max-width: 34px; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.vbar-label { font-size: 11px; color: var(--dim); white-space: nowrap; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

/* 时间线 */
.timeline-day { color: var(--dim); font-size: 13px; font-weight: 600; margin: 14px 0 8px; }
.tl-item { display: flex; gap: 10px; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; }
.tl-time { color: var(--dim); font-size: 12px; }
.tl-content { white-space: pre-wrap; overflow-wrap: anywhere; }

/* 周报 */
.report-out {
  white-space: pre-wrap;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.7;
}
.week-nav { display: flex; align-items: center; gap: 8px; }
.week-nav .week-label { flex: 1; text-align: center; font-weight: 600; }

/* 设置 */
.setting-group { margin-bottom: 20px; }
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.setting-item:last-child { border-bottom: none; }
.setting-label { font-size: 14px; }
.setting-sub { font-size: 12px; color: var(--dim); margin-top: 2px; }

/* 隐私空间（独立全屏层，与工作区 DOM 物理隔离） */
.vault-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 85;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}
.vault-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.vault-title { flex: 1; font-weight: 700; font-size: 16px; user-select: none; -webkit-user-select: none; }
.vault-tabs { padding: 10px 14px 0; }
.vault-list { flex: 1; overflow-y: auto; padding: 10px 14px 80px; }
.vault-fab {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  right: max(16px, calc(50% - 380px + 16px));
  z-index: 86;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}
.vault-center {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: auto;
}
.vault-box {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}
.vault-box h2 { margin: 0 0 4px; font-size: 18px; }
.vault-box .vault-sub { color: var(--dim); font-size: 13px; margin: 0 0 16px; }
.vault-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 95;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
}
@media (min-width: 600px) {
  .vault-dialog-overlay { align-items: center; padding: 24px; }
}
.recovery-code {
  font-family: Consolas, monospace;
  font-size: 17px;
  letter-spacing: 2px;
  background: var(--input-bg);
  border: 1px dashed var(--accent);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  user-select: all;
  word-break: break-all;
}
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.check-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--dim);
  flex: none;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
}
.check-circle.checked { background: var(--ok); border-color: var(--ok); color: #fff; }

/* 一句话录入 */
.quickadd { padding: 10px 14px; }
.quickadd input { font-size: 16px; }
.qa-preview {
  margin-top: 8px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.qa-preview .item-meta { flex: 1; min-width: 0; }

/* 折叠区（表单精简：次要字段收进「更多」） */
details.coll { margin-bottom: 12px; }
details.coll summary {
  cursor: pointer;
  color: var(--dim);
  font-size: 13px;
  padding: 4px 0;
  user-select: none;
  -webkit-user-select: none;
}
details.coll[open] summary { margin-bottom: 4px; }
