/* ============================================================
   Notes / 笔记板块样式（单栏月度卡片布局 + 顶部公共操作栏）
   ============================================================ */

.view-notes {
  padding-top: 18px;
}

.primary-tabs .hub-gated-tab {
  display: none !important;
}

body.hub-signed-in .primary-tabs .hub-gated-tab {
  display: inline-flex !important;
}

body.hub-signed-in .primary-tabs #tab-expenses {
  margin-left: auto;
}

.primary-tabs a {
  min-width: 96px;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 768px) {
  body.hub-signed-in .primary-tabs #tab-expenses {
    margin-left: 0;
  }
}

.primary-tabs #tab-research {
  min-width: 118px;
}

/* 顶部搜索与“+ 笔记”按钮栏 */
.notes-top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notes-top-bar .search {
  flex: 1;
}

.notes-add-btn {
  height: 46px;
  padding: 0 16px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 13px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .15s ease;
}

.notes-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--soft);
  transform: translateY(-1px);
}

.notes-add-btn:active {
  transform: translateY(0);
}

.notes-add-btn svg {
  display: block;
}

/* 弹窗：新建/快速整理录入笔记 */
.notes-modal-dialog {
  width: min(calc(100% - 32px), 640px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .28);
  outline: none;
}

.notes-modal-dialog::backdrop {
  background: rgba(0, 0, 0, .48);
  backdrop-filter: blur(4px);
}

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

.notes-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
}

.notes-modal-close {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .15s;
}

.notes-modal-close:hover {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent);
}

.notes-modal-body {
  padding: 20px;
}

.notes-modal-footer-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.notes-modal-footer-hint b {
  color: var(--text);
  font-weight: 600;
}

/* 快速录入输入框及按钮 */
.notes-input-wrapper {
  position: relative;
  width: 100%;
}

.notes-textarea {
  width: 100%;
  min-height: 180px;
  max-height: 420px;
  padding: 14px 54px 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  outline: none;
  box-sizing: border-box;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
  display: block;
}

.notes-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.notes-circle-submit {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  transition: transform .15s ease, border-color .15s ease;
  z-index: 2;
  padding: 0;
}

.notes-circle-submit:hover {
  transform: scale(1.08);
  border-color: var(--accent);
}

.notes-circle-submit:active {
  transform: scale(0.95);
}

.notes-circle-submit svg {
  width: 19px;
  height: 19px;
  display: block;
}

.notes-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}

.notes-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.notes-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
  min-width: 64px;
  box-sizing: border-box;
}

.notes-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.notes-button.ghost {
  background: var(--card);
  border-color: var(--line);
}

.notes-button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.notes-button.primary:hover {
  filter: brightness(1.08);
  color: #fff;
}

/* ============================================================
   单栏月度卡片布局（月份在最左侧，无卡片内重复操作栏）
   ============================================================ */

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
}

.notes-month-card {
  display: flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .03);
  transition: border-color .15s, box-shadow .15s;
}

.notes-month-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: 0 4px 16px rgba(0, 0, 0, .06);
}

/* 月份最左侧区域（不加粗） */
.notes-month-aside {
  flex: 0 0 120px;
  background: color-mix(in srgb, var(--bg) 65%, var(--card));
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  gap: 10px;
}

.notes-month-year {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  display: block;
}

.notes-month-num {
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -.01em;
  display: block;
  margin-top: 2px;
}

.notes-month-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  background: color-mix(in srgb, var(--line) 60%, transparent);
  padding: 3px 10px;
  border-radius: 999px;
}

/* 右侧笔记条目主体 */
.notes-month-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.notes-month-items {
  display: flex;
  flex-direction: column;
}

/* 单条笔记行 */
.notes-item-row {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: background-color .15s;
}

.notes-item-row:last-child {
  border-bottom: 0;
}

.notes-item-row:hover {
  background-color: color-mix(in srgb, var(--soft) 28%, transparent);
}

.notes-item-row.selected {
  background-color: color-mix(in srgb, var(--accent) 7%, transparent);
}

.notes-item-row.archived {
  opacity: .68;
  background: color-mix(in srgb, var(--bg) 35%, transparent);
}

.notes-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.notes-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.notes-item-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* 网页标题不加粗，过长时省略号截断 */
.notes-item-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  text-decoration: none;
  line-height: 1.35;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.notes-item-title:hover {
  color: var(--accent);
  text-decoration: underline;
}

.notes-item-title svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  opacity: .6;
}

.notes-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}

.notes-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  color: var(--muted);
}

.notes-status-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.notes-status-tag.archived {
  background: color-mix(in srgb, var(--muted) 16%, transparent);
  color: var(--muted);
}

/* URL 已隐去（网页标题已具备跳转链接） */
.notes-card-url {
  display: none;
}

/* 注释主体行：左侧注释内容，右侧操作按钮并排对齐 */
.notes-item-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
}

/* 注释行：不显示左侧竖线，左侧自然对齐 */
.notes-card-notes {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border-left: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.notes-card-notes.empty {
  display: block;
}

/* 右侧操作按钮：默认隐藏，鼠标悬停条目时显示，与注释第一行对齐 */
.notes-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

.notes-item-row:hover .notes-item-actions,
.notes-item-row:focus-within .notes-item-actions {
  opacity: 1;
  pointer-events: auto;
}

.notes-item-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  font-size: 12px;
  line-height: inherit;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
  box-sizing: border-box;
  min-width: auto;
}

.notes-item-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.notes-item-action-btn.danger {
  color: #c44848;
}

.notes-item-action-btn.danger:hover {
  border-color: #c44848;
  background: color-mix(in srgb, #c44848 10%, transparent);
}

@media (hover: none) {
  .notes-item-actions {
    opacity: 1;
    pointer-events: auto;
  }
}

.notes-empty {
  width: 100%;
  padding: 46px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: color-mix(in srgb, var(--card) 40%, transparent);
}

.notes-empty p {
  margin: 6px 0 0;
  font-size: 13px;
}

/* Toast 提示 */
.notes-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #17191c;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .24);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: transform .2s ease, opacity .2s ease;
}

@media(prefers-color-scheme: dark) {
  .notes-toast {
    background: #f3f4f6;
    color: #17191c;
  }
}

.notes-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 移动端响应式 */
@media(max-width: 820px) {
  .notes-month-card {
    flex-direction: column;
  }
  .notes-month-aside {
    flex: 0 0 auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    padding: 12px 16px;
  }
  .notes-month-label {
    display: flex;
    align-items: baseline;
    gap: 6px;
  }
  .notes-month-num {
    font-size: 16px;
    margin-top: 0;
  }
  .notes-item-header {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .notes-item-meta {
    justify-content: space-between;
    width: 100%;
  }
}
