/* memo.css - 备忘录页面样式 */
.memo-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 64px);
  box-sizing: border-box;
}

.memo-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.memo-stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.memo-stat-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #222;
}

.memo-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f3f3f3;
  font-size: 14px;
  color: #555;
}

.memo-stat-row:last-child {
  border-bottom: none;
}

.memo-stat-row b {
  font-size: 18px;
  color: #222;
}

.memo-tip {
  background: linear-gradient(135deg, #fffbeb 0%, #fff8e1 100%);
  border: 1px solid #ffe082;
  border-radius: 16px;
  padding: 16px;
  font-size: 13px;
  color: #7d6a3e;
}

.memo-tip-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.memo-tip p {
  margin: 6px 0;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
}

.memo-main {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
  min-height: calc(100vh - 104px);
  box-sizing: border-box;
  min-width: 0; /* grid 子项允许收缩，防止手机端被 textarea 固有宽度撑出屏幕 */
}

.memo-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.memo-hero-title {
  font-size: 22px;
  margin: 0 0 4px 0;
  color: #222;
}

.memo-hero-sub {
  margin: 0;
  font-size: 13px;
  color: #888;
}

.memo-add-btn {
  background: #222;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s, background .2s;
}

.memo-add-btn:hover {
  background: #444;
}

.memo-add-btn:active {
  transform: scale(0.98);
}

.memo-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.memo-filter {
  background: #f6f6f6;
  border: none;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  transition: all .2s;
}

.memo-filter:hover {
  background: #eee;
}

.memo-filter.active {
  background: #222;
  color: #fff;
}

.memo-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.memo-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fafafa;
  border: 1px solid #f0f0f0;
  transition: all .2s;
  position: relative;
}

.memo-item:hover {
  border-color: #ddd;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.memo-item.done {
  opacity: 0.55;
}

.memo-item.overdue {
  border-left: 4px solid #ff4d4f;
  background: #fff5f5;
}

.memo-item.today {
  border-left: 4px solid #F5D547;
  background: #fffbe6;
}

.memo-item-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid #ccc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all .2s;
}

.memo-item.done .memo-item-checkbox {
  background: #52c41a;
  border-color: #52c41a;
  color: #fff;
}

.memo-item-content {
  flex: 1;
  min-width: 0;
}

.memo-item-title {
  font-size: 15px;
  color: #222;
  margin-bottom: 9px;
  word-break: break-word;
}

.memo-item.done .memo-item-title {
  text-decoration: line-through;
  color: #888;
}

.memo-item-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: #888;
  flex-wrap: wrap;
  align-items: center;
}

/* 日期 + 天后数固定同行，金额标签不够宽时才换行 */
.memo-meta-pair {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}

.memo-item-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #eee;
}

.memo-item-tag.overdue {
  color: #ff4d4f;
  border-color: #ffccc7;
  background: #fff2f0;
}

.memo-item-tag.today {
  color: #d48806;
  border-color: #ffe58f;
  background: #fffbe6;
}

.memo-item-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .2s;
}

.memo-item:hover .memo-item-actions {
  opacity: 1;
}

.memo-item-btn {
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: transform .1s, opacity .15s;
}

.memo-item-btn.edit {
  background: #EAF2FF;
  color: #2F6FED;
}

.memo-item-btn.del {
  background: #FFEEEE;
  color: #E5484D;
}

.memo-item-btn:hover {
  opacity: .8;
}

.memo-item-btn:active {
  transform: scale(0.95);
}

.memo-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.memo-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.memo-empty-text {
  font-size: 16px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.memo-empty-sub {
  font-size: 13px;
}

/* 弹窗 */
.memo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.memo-modal {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.memo-modal-head {
  padding: 18px 20px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.memo-modal-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.memo-modal-close {
  background: #f5f5f5;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: #666;
}

.memo-modal-body {
  padding: 10px 20px 20px;
  overflow-y: auto;
}

.memo-field {
  margin-bottom: 14px;
}

.memo-field label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.memo-input,
.memo-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}

.memo-input:focus,
.memo-textarea:focus {
  border-color: #F5D547;
}

.memo-textarea {
  min-height: 80px;
  resize: vertical;
}

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

.memo-modal-foot {
  padding: 0 20px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 删除确认小弹窗 */
.memo-confirm-modal { max-width: 320px; width: calc(100% - 60px); }
.memo-confirm-text { padding: 22px 20px 10px; font-size: 15px; color: #222; text-align: center; }
.memo-confirm-modal .memo-modal-foot { justify-content: center; }
.memo-confirm-modal .memo-btn.primary { background: #E5484D; color: #fff; }

.memo-btn {
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 14px;
  cursor: pointer;
  border: none;
}

.memo-btn.secondary {
  background: #f5f5f5;
  color: #555;
}

.memo-btn.primary {
  background: #222;
  color: #fff;
}

/* 手机端内联快速输入框（PC 端隐藏） */
.memo-quick-inline { display: none; }
@media (max-width: 768px) {
  .memo-quick-inline {
    display: block;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 16px;
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.05);
  }
  .memo-quick-area {
    width: 100%;
    min-width: 0; /* textarea 固有宽度不撑破卡片 */
    max-width: 100%;
    height: 72px; /* 固定高度，添加按钮紧跟其后不留大片空白 */
    box-sizing: border-box;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    font-family: inherit;
  }
  .memo-quick-area:focus { border-color: #F5D547; box-shadow: 0 0 0 3px rgba(245, 213, 71, 0.15); }
  .memo-quick-meta { margin-top: 8px; font-size: 12px; color: #888; min-height: 0; }
  .memo-quick-meta .parsed-row { display: flex; flex-wrap: wrap; gap: 6px; }
  .memo-quick-meta .parsed-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px; background: #f8f8f8; border: 1px solid #eee; color: #555; }
  .memo-quick-btn { width: 100%; margin-top: 12px; background: #222; color: #fff; border: none; border-radius: 10px; padding: 10px 0; font-size: 14px; font-weight: 600; cursor: pointer; }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .memo-shell {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .memo-side {
    display: none;
  }

  .memo-main {
    padding: 16px;
    border-radius: 16px;
  }

  .memo-hero {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .memo-add-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
  }

  .memo-filter-bar {
    gap: 6px;
  }

  .memo-filter {
    padding: 6px 12px;
    font-size: 12px;
  }

  .memo-item-actions {
    opacity: 1;
  }

  .memo-row {
    grid-template-columns: 1fr;
  }
}

/* 重复选择条（不重复/每周/每月 + 星期多选） */
.memo-repeat-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.memo-repeat-bar .memo-filter { flex-shrink: 0; }
