/* ====== AI 备忘录面板样式 ====== */
#ai-memo-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 500px;
  background: #ffffff;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  box-shadow:
    4px 0 24px rgba(0, 0, 0, 0.12),
    1px 0 0 rgba(0, 0, 0, 0.05);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  transform: translateX(-110%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: text;
  -webkit-user-select: text;
  cursor: default;
}
#ai-memo-panel.memo-visible {
  transform: translateX(0);
}

/* -- 头部 -- */
.memo-header {
  background: linear-gradient(135deg, #3478F6 0%, #3478F6 50%, #2563EB 100%);
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.memo-header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -20%;
  width: 140%;
  height: 140%;
  background: radial-gradient(
    circle at 30% 40%,
    rgba(255, 255, 255, 0.12) 0%,
    transparent 60%
  );
  pointer-events: none;
}
.memo-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.memo-header-icon {
  font-size: 20px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}
.memo-header-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.memo-header-count {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 4px;
}
.memo-header-actions {
  display: flex;
  gap: 6px;
}
.memo-header-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.2s;
}
.memo-header-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* -- 新增区域 -- */
.memo-add-area {
  padding: 12px 14px;
  background: #f5f5f7;
  border-bottom: 1px solid #e5e5e7;
  flex-shrink: 0;
}
.memo-add-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.memo-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #d1d1d6;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  box-sizing: border-box;
  font-family: inherit;
  resize: none;
}
.memo-input:focus {
  border-color: #3478F6;
  box-shadow: 0 0 0 3px rgba(52, 120, 246, 0.1);
}
.memo-input::placeholder {
  color: #86868b;
}
.memo-add-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
}
.memo-deadline-input {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid #d1d1d6;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
  font-family: inherit;
  color: #48484a;
}
.memo-deadline-input:focus {
  border-color: #3478F6;
}
.memo-add-btn {
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #3478F6 0%, #3478F6 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}
.memo-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(52, 120, 246, 0.35);
}
.memo-add-btn:active {
  transform: translateY(0);
}

/* -- 列表区域 -- */
.memo-list-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.memo-list-wrapper::-webkit-scrollbar {
  width: 4px;
}
.memo-list-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.memo-list-wrapper::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 2px;
}

/* 空状态 */
.memo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: #86868b;
}
.memo-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.memo-empty-text {
  font-size: 14px;
  color: #86868b;
}

/* 单条备忘 */
.memo-item {
  padding: 12px 14px;
  margin: 0 8px 6px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e5e7;
  transition: all 0.2s;
  animation: memo-slide-in 0.25s ease-out;
  position: relative;
}
.memo-item:hover {
  border-color: #3478F6;
  box-shadow: 0 2px 8px rgba(52, 120, 246, 0.1);
}

@keyframes memo-slide-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.memo-item-content {
  font-size: 13px;
  color: #1d1d1f;
  line-height: 1.6;
  word-break: break-word;
  margin-bottom: 8px;
}
.memo-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.memo-item-deadline {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #86868b;
}
.memo-item-deadline-icon {
  font-size: 12px;
}

/* AI 来源标签 */
.memo-ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: #3478F6;
  background: rgba(52, 120, 246, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 500;
}

/* 发起人标签 */
.memo-initiator-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: #e67e22;
  background: rgba(230, 126, 34, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 500;
}


.memo-item-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.memo-item:hover .memo-item-actions {
  opacity: 1;
}
.memo-action-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.15s;
}
.memo-action-btn:hover {
  background: rgba(0,0,0,0.04);
}
.memo-action-btn.danger:hover {
  background: #fff0f0;
}

/* -- 内联编辑模式 -- */
.memo-item-editing {
  border-color: #3478F6;
  box-shadow: 0 2px 12px rgba(52, 120, 246, 0.15);
}
.memo-edit-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid #d1d1d6;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: #1d1d1f;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}
.memo-edit-textarea:focus {
  border-color: #3478F6;
  box-shadow: 0 0 0 3px rgba(52, 120, 246, 0.1);
}
.memo-edit-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.memo-edit-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.memo-edit-label {
  font-size: 11px;
  color: #86868b;
  font-weight: 500;
}
.memo-edit-input {
  width: 100%;
  padding: 5px 8px;
  border: 1.5px solid #d1d1d6;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  color: #48484a;
  transition: border-color 0.2s;
}
.memo-edit-input:focus {
  border-color: #3478F6;
}
.memo-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.memo-edit-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.memo-edit-btn-cancel {
  background: #e8e8ed;
  color: #6e6e73;
}
.memo-edit-btn-cancel:hover {
  background: #d1d1d6;
}
.memo-edit-btn-save {
  background: linear-gradient(135deg, #3478F6 0%, #3478F6 100%);
  color: #fff;
}
.memo-edit-btn-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(52, 120, 246, 0.3);
}

/* -- 已过期标记 -- */
.memo-item.overdue {
  border-color: #ffcccc;
  background: #fffafa;
}
.memo-item.overdue .memo-item-deadline {
  color: #FF3B30;
  font-weight: 600;
}

/* -- 完成状态 -- */
.memo-item.done .memo-item-content {
  text-decoration: line-through;
  color: #86868b;
}

/* -- 导航图标 hover -- */
#ai-memo-nav-icon .rong-nav-icon.hover {
  display: none;
}
#ai-memo-nav-icon .rong-nav-icon:not(.hover) {
  display: block;
}
#ai-memo-nav-icon:hover .rong-nav-icon.hover {
  display: block;
}
#ai-memo-nav-icon:hover .rong-nav-icon:not(.hover) {
  display: none;
}

/* 导航徽标 */
.memo-nav-badge {
  position: absolute;
  top: 6px;
  right: 12px;
  min-width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3478F6;
  display: none;
}

/* ====== 确认弹框样式 ====== */
.memo-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease-out;
  backdrop-filter: blur(2px);
}
.memo-confirm-overlay.memo-confirm-visible {
  opacity: 1;
}

.memo-confirm-dialog {
  width: 460px;
  max-width: 90vw;
  max-height: 80vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}
.memo-confirm-visible .memo-confirm-dialog {
  transform: scale(1) translateY(0);
}

/* 弹框头部 */
.memo-confirm-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #3478F6 0%, #2563EB 100%);
  display: flex;
  align-items: center;
  gap: 8px;
}
.memo-confirm-header-error {
  background: linear-gradient(135deg, #FF3B30 0%, #d62d22 100%);
}
.memo-confirm-header-success {
  background: linear-gradient(135deg, #3478F6 0%, #3478F6 50%, #2563EB 100%);
}
.memo-confirm-header-icon {
  font-size: 20px;
}
.memo-confirm-header-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

/* 弹框主体 */
.memo-confirm-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

/* 原始消息 */
.memo-confirm-source {
  margin-bottom: 16px;
}
.memo-confirm-source-label {
  font-size: 11px;
  color: #86868b;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.memo-confirm-source-text {
  font-size: 13px;
  color: #6e6e73;
  background: #f5f5f7;
  border-radius: 8px;
  padding: 10px 12px;
  border-left: 3px solid #3478F6;
  line-height: 1.6;
  max-height: 80px;
  overflow-y: auto;
  word-break: break-word;
}

/* 加载状态 */
.memo-confirm-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
}
.memo-confirm-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e5e5e7;
  border-top-color: #3478F6;
  border-radius: 50%;
  margin-bottom: 12px;
  animation: memo-spin 0.8s linear infinite;
}
@keyframes memo-spin {
  to { transform: rotate(360deg); }
}
.memo-confirm-loading-text {
  font-size: 13px;
  color: #86868b;
}

/* 错误状态 */
.memo-confirm-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
}
.memo-confirm-error-icon {
  font-size: 32px;
  margin-bottom: 8px;
}
.memo-confirm-error-text {
  font-size: 13px;
  color: #FF3B30;
  text-align: center;
  line-height: 1.5;
}

/* 结果内容 */
.memo-confirm-result {
  margin-bottom: 12px;
}
.memo-confirm-result-label {
  font-size: 12px;
  color: #1d1d1f;
  font-weight: 600;
  margin-bottom: 6px;
}
.memo-confirm-result-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #d1d1d6;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: #1d1d1f;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.memo-confirm-result-textarea:focus {
  border-color: #3478F6;
  box-shadow: 0 0 0 3px rgba(52, 120, 246, 0.1);
}

/* 元信息行（交付人 + 截止时间） */
.memo-confirm-meta-row {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
}
.memo-confirm-meta-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.memo-confirm-meta-label {
  font-size: 12px;
  color: #1d1d1f;
  font-weight: 600;
  white-space: nowrap;
}
.memo-confirm-meta-input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid #d1d1d6;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  color: #48484a;
  transition: border-color 0.2s;
}
.memo-confirm-meta-input:focus {
  border-color: #3478F6;
}
.memo-confirm-deadline-input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid #d1d1d6;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  color: #48484a;
  transition: border-color 0.2s;
}
.memo-confirm-deadline-input:focus {
  border-color: #3478F6;
}

/* 弹框底部 */
.memo-confirm-footer {
  padding: 12px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid #e5e5e7;
  background: #f5f5f7;
}

/* 按钮样式 */
.memo-confirm-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.memo-confirm-btn-cancel {
  background: #e8e8ed;
  color: #6e6e73;
}
.memo-confirm-btn-cancel:hover {
  background: #d1d1d6;
}
.memo-confirm-btn-retry {
  background: #fff3e0;
  color: #e67e22;
}
.memo-confirm-btn-retry:hover {
  background: #ffe8c8;
  transform: translateY(-1px);
}
.memo-confirm-btn-confirm {
  background: linear-gradient(135deg, #3478F6 0%, #3478F6 100%);
  color: #fff;
  font-weight: 600;
}
.memo-confirm-btn-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(52, 120, 246, 0.35);
}
.memo-confirm-btn-confirm:active {
  transform: translateY(0);
}

/* ====== 右键菜单项样式 ====== */
.ai-memo-context-menu-item {
  cursor: pointer;
}

/* ====== 暗色模式适配 ====== */
html[data-theme="dark"] #ai-memo-panel {
  background: #1c1c1e;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .memo-add-area {
  background: #2c2c2e;
  border-bottom-color: #3a3a3c;
}
html[data-theme="dark"] .memo-input,
html[data-theme="dark"] .memo-deadline-input {
  background: #1c1c1e;
  border-color: #3a3a3c;
  color: #e5e5ea;
}
html[data-theme="dark"] .memo-input:focus,
html[data-theme="dark"] .memo-deadline-input:focus {
  border-color: #3478F6;
  box-shadow: 0 0 0 3px rgba(52, 120, 246, 0.15);
}
html[data-theme="dark"] .memo-input::placeholder {
  color: #86868b;
}
html[data-theme="dark"] .memo-item {
  background: #2c2c2e;
  border-color: #3a3a3c;
}
html[data-theme="dark"] .memo-item:hover {
  border-color: #3478F6;
  box-shadow: 0 2px 8px rgba(52, 120, 246, 0.15);
}
html[data-theme="dark"] .memo-item-content {
  color: #e5e5ea;
}
html[data-theme="dark"] .memo-item-deadline {
  color: #86868b;
}
html[data-theme="dark"] .memo-action-btn:hover {
  background: #3a3a3c;
}
html[data-theme="dark"] .memo-action-btn.danger:hover {
  background: #3a2020;
}
html[data-theme="dark"] .memo-item-editing {
  border-color: #3478F6;
  box-shadow: 0 2px 12px rgba(52, 120, 246, 0.2);
}
html[data-theme="dark"] .memo-edit-textarea {
  background: #2c2c2e;
  border-color: #3a3a3c;
  color: #e5e5ea;
}
html[data-theme="dark"] .memo-edit-textarea:focus {
  border-color: #3478F6;
  box-shadow: 0 0 0 3px rgba(52, 120, 246, 0.15);
}
html[data-theme="dark"] .memo-edit-label {
  color: #86868b;
}
html[data-theme="dark"] .memo-edit-input {
  background: #2c2c2e;
  border-color: #3a3a3c;
  color: #e5e5ea;
}
html[data-theme="dark"] .memo-edit-btn-cancel {
  background: #3a3a3c;
  color: #a1a1a6;
}
html[data-theme="dark"] .memo-edit-btn-cancel:hover {
  background: #48484a;
}
html[data-theme="dark"] .memo-item.overdue {
  border-color: #5a2020;
  background: #2a1a1a;
}
html[data-theme="dark"] .memo-item.done .memo-item-content {
  color: #86868b;
}
html[data-theme="dark"] .memo-empty-text {
  color: #86868b;
}
html[data-theme="dark"] .memo-list-wrapper::-webkit-scrollbar-thumb {
  background: #48484a;
}
html[data-theme="dark"] .memo-ai-tag {
  background: rgba(52, 120, 246, 0.15);
  color: #5a9aff;
}
html[data-theme="dark"] .memo-initiator-tag {
  background: rgba(230, 126, 34, 0.15);
  color: #f0a050;
}

/* -- 暗色模式：确认弹框 -- */
html[data-theme="dark"] .memo-confirm-overlay {
  background: rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .memo-confirm-dialog {
  background: #2c2c2e;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .memo-confirm-body {
  color: #e5e5ea;
}
html[data-theme="dark"] .memo-confirm-source-text {
  background: #2c2c2e;
  color: #a1a1a6;
  border-left-color: #3478F6;
}
html[data-theme="dark"] .memo-confirm-source-label {
  color: #86868b;
}
html[data-theme="dark"] .memo-confirm-result-label {
  color: #e5e5ea;
}
html[data-theme="dark"] .memo-confirm-result-textarea {
  background: #2c2c2e;
  border-color: #3a3a3c;
  color: #e5e5ea;
}
html[data-theme="dark"] .memo-confirm-result-textarea:focus {
  border-color: #3478F6;
  box-shadow: 0 0 0 3px rgba(52, 120, 246, 0.15);
}
html[data-theme="dark"] .memo-confirm-meta-label {
  color: #e5e5ea;
}
html[data-theme="dark"] .memo-confirm-meta-input {
  background: #2c2c2e;
  border-color: #3a3a3c;
  color: #e5e5ea;
}
html[data-theme="dark"] .memo-confirm-deadline-input {
  background: #2c2c2e;
  border-color: #3a3a3c;
  color: #e5e5ea;
}
html[data-theme="dark"] .memo-confirm-footer {
  background: #2c2c2e;
  border-top-color: #3a3a3c;
}
html[data-theme="dark"] .memo-confirm-btn-cancel {
  background: #3a3a3c;
  color: #a1a1a6;
}
html[data-theme="dark"] .memo-confirm-btn-cancel:hover {
  background: #48484a;
}
html[data-theme="dark"] .memo-confirm-btn-retry {
  background: rgba(230, 126, 34, 0.15);
  color: #f0a050;
}
html[data-theme="dark"] .memo-confirm-btn-retry:hover {
  background: rgba(230, 126, 34, 0.25);
}
html[data-theme="dark"] .memo-confirm-loading-text {
  color: #86868b;
}
html[data-theme="dark"] .memo-confirm-spinner {
  border-color: #3a3a3c;
  border-top-color: #3478F6;
}
