.notes-section {
  margin-top: 54px;
}

.notes-heading,
.notes-list-toolbar,
.note-editor-meta,
.note-editor-footer,
.note-ai-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.notes-heading {
  margin-bottom: 20px;
}

.notes-heading h2 {
  margin: 0;
  font-size: 22px;
}

.notes-heading > div > p:last-child {
  margin: 7px 0 0;
  color: #9299ab;
  font-size: 12px;
}

.notes-add-button {
  padding: 10px 15px;
  border: 0;
  border-radius: 10px;
  background: #715cf7;
  color: #fff;
  font-weight: 700;
}

.notes-add-button span {
  margin-right: 6px;
}

.notes-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 600px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 35px rgba(31, 38, 58, .05);
}

.notes-layout.has-detail {
  grid-template-columns: 270px minmax(0, 1fr);
}

.notes-list-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 18px 14px;
  border-right: 0;
  background: #fafafe;
}

.notes-layout.has-detail .notes-list-panel {
  border-right: 1px solid var(--line);
}

.notes-list-toolbar {
  padding: 0 4px 13px;
  color: #394157;
  font-size: 13px;
}

.notes-count {
  color: #9aa1b1;
  font-size: 10px;
}

.notes-search {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 13px;
  padding: 8px 10px;
  border: 1px solid #e7e8f0;
  border-radius: 9px;
  background: #fff;
  color: #9aa1b1;
}

.notes-search input {
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
}

.notes-list {
  display: grid;
  gap: 7px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #dedbea transparent;
}

.notes-layout:not(.has-detail) .notes-list {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  align-content: start;
}

.notes-layout:not(.has-detail) .note-list-item {
  min-height: 92px;
  border-color: #ececf3;
  background: #fff;
}

.note-list-item {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #4c556a;
  text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.note-list-item:hover {
  border-color: #e6e3fb;
  background: #fff;
  transform: translateY(-1px);
}

.note-list-item.is-active {
  border-color: #dcd7fb;
  background: #f1efff;
}

.note-list-item strong {
  overflow: hidden;
  color: #293147;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-list-item span {
  overflow: hidden;
  color: #8d94a5;
  font-size: 10px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-list-item time {
  color: #7770b4;
  font: 500 9px "DM Mono", monospace;
}

.notes-list-empty {
  margin: 24px 8px;
  color: #a0a6b5;
  font-size: 11px;
  text-align: center;
}

.notes-detail-panel {
  min-width: 0;
  padding: clamp(24px, 4vw, 48px);
}

.note-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.note-detail-actions button {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #697186;
  font-size: 10px;
}

.note-detail-actions button:hover {
  border-color: #dcd7fb;
  color: #5f52d2;
}

.note-reader-title {
  margin: 0;
  color: #222a3f;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -.04em;
}

.note-reader-date {
  display: block;
  margin-top: 10px;
  color: #8179bb;
  font: 500 10px "DM Mono", monospace;
}

.note-reader-content,
.note-wysiwyg-editor {
  min-height: 410px;
  padding: 30px 2px 48px;
  color: #3f475a;
  font-size: 14px;
  line-height: 1.9;
}

.note-wysiwyg-editor {
  outline: 0;
  caret-color: #6659d8;
}

.note-wysiwyg-editor:empty::before {
  color: #b0b5c2;
  content: attr(data-placeholder);
  pointer-events: none;
}

.note-wysiwyg-editor:focus {
  box-shadow: inset 0 -1px 0 #eeeafb;
}

.note-reader-content h1,
.note-reader-content h2,
.note-reader-content h3,
.note-reader-content h4,
.note-wysiwyg-editor h1,
.note-wysiwyg-editor h2,
.note-wysiwyg-editor h3,
.note-wysiwyg-editor h4 {
  margin: 1.4em 0 .55em;
  color: #293147;
  line-height: 1.35;
}

.note-reader-content h1,
.note-wysiwyg-editor h1 { font-size: 24px; }
.note-reader-content h2,
.note-wysiwyg-editor h2 { font-size: 20px; }
.note-reader-content h3,
.note-wysiwyg-editor h3 { font-size: 17px; }
.note-reader-content h4,
.note-wysiwyg-editor h4 { font-size: 15px; }
.note-reader-content p,
.note-wysiwyg-editor p,
.note-wysiwyg-editor div { margin: 0 0 13px; }
.note-reader-content ul,
.note-reader-content ol,
.note-wysiwyg-editor ul,
.note-wysiwyg-editor ol { margin: 0 0 16px; padding-left: 24px; }
.note-reader-content blockquote,
.note-wysiwyg-editor blockquote {
  margin: 16px 0;
  padding: 8px 14px;
  border-left: 3px solid #c9c2f6;
  background: #faf9ff;
  color: #626b7e;
}
.note-reader-content code,
.note-wysiwyg-editor code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #f1f0f8;
  color: #5b4fc4;
  font: 500 .9em "DM Mono", monospace;
}
.note-reader-content pre,
.note-wysiwyg-editor pre {
  overflow-x: auto;
  padding: 14px;
  border-radius: 9px;
  background: #242a3a;
  color: #f5f4fb;
}
.note-reader-content pre code { padding: 0; background: transparent; color: inherit; }
.note-reader-content a { color: #6659d8; text-underline-offset: 3px; }
.note-reader-empty { color: #a0a6b5; }

.note-wysiwyg-editor pre code { padding: 0; background: transparent; color: inherit; }
.note-wysiwyg-editor a { color: #6659d8; text-underline-offset: 3px; }

.note-reader[hidden],
.notes-editor[hidden],
.notes-detail-panel[hidden],
.note-wysiwyg-editor[hidden],
.note-markdown-editor[hidden] {
  display: none !important;
}

.notes-editor {
  display: grid;
  gap: 14px;
}

.note-title-input {
  width: 100%;
  padding: 0 0 12px;
  border: 0;
  border-bottom: 1px solid #ececf3;
  outline: 0;
  background: transparent;
  color: #222a3f;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: -.04em;
}

.note-editor-meta label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8d94a5;
  font-size: 10px;
}

.note-date-input {
  width: auto;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #596277;
  font: 500 10px "DM Mono", monospace;
}

.note-save-status {
  color: #969cad;
  font-size: 9px;
}

.note-format-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 7px;
  border: 1px solid #e9e9f1;
  border-radius: 10px;
  background: #fafafe;
}

.note-format-toolbar > button,
.note-custom-color {
  display: inline-grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #626b7e;
  font-size: 10px;
}

.note-format-toolbar > button:hover,
.note-custom-color:hover {
  border-color: #dedaf9;
  background: #fff;
  color: #5d50cf;
}

.note-toolbar-divider {
  width: 1px;
  height: 20px;
  margin: 0 2px;
  background: #e1e2ea;
}

.note-color-swatches {
  display: flex;
  align-items: center;
  gap: 5px;
}

.note-color-swatch {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #dfe1e9;
}

.note-custom-color {
  grid-auto-flow: column;
  gap: 5px;
  cursor: pointer;
}

.note-custom-color input {
  width: 17px;
  height: 17px;
  padding: 0;
  border: 0;
  background: transparent;
}

.note-format-toolbar .note-ai-button {
  margin-left: auto;
  border-color: #dedaf9;
  background: #fff;
  color: #6659d8;
  font-weight: 700;
}

.note-markdown-editor {
  width: 100%;
  min-height: 390px;
  resize: vertical;
  padding: 18px 16px 36px;
  border: 1px solid #ececf3;
  border-radius: 10px;
  outline: 0;
  background: #fff;
  color: #3f475a;
  font: 13px/1.8 "DM Mono", "Segoe UI", sans-serif;
}

.note-markdown-editor:focus {
  border-color: #cfc9f7;
  box-shadow: 0 0 0 3px rgba(113, 92, 247, .08);
}

.note-editor-footer {
  padding-top: 14px;
  border-top: 1px solid #efeff4;
}

.note-delete-button,
.note-save-button,
.note-ai-actions button {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #697186;
  font-size: 11px;
}

.note-delete-button:hover {
  border-color: #efcfcc;
  color: #b35b55;
}

.note-save-button,
.note-ai-actions .save-task {
  border-color: #715cf7;
  background: #715cf7;
  color: #fff;
  font-weight: 700;
}

.note-ai-dialog {
  width: min(560px, calc(100% - 35px));
}

.note-ai-dialog section {
  position: relative;
  display: grid;
  gap: 13px;
}

.note-ai-dialog h2 {
  margin: 0;
}

.note-ai-dialog label {
  display: grid;
  gap: 6px;
  color: #626b7e;
  font-size: 11px;
}

.note-ai-dialog select {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.note-ai-hint,
.note-ai-status {
  margin: 0;
  color: #9299ab;
  font-size: 10px;
  line-height: 1.6;
}

.note-ai-status {
  min-height: 16px;
  color: #6659d8;
}

.note-ai-preview {
  max-height: 250px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid #e4e1fb;
  border-radius: 10px;
  background: #faf9ff;
}

.note-ai-preview p {
  margin: 8px 0 0;
  color: #525b70;
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.calendar-day {
  position: relative;
  padding: 0;
}

.calendar-day-open {
  display: block;
  width: 100%;
  min-height: 82px;
  padding: 9px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.calendar-day-open small {
  display: block;
  margin-top: 7px;
}

.calendar-day-note-count {
  color: #9b6c43 !important;
}

.calendar-quick-add {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, .72);
  color: #a2a8b5;
  font-size: 15px;
  line-height: 1;
}

.calendar-quick-add:hover,
.calendar-quick-add:focus-visible {
  border-color: #ddd8fb;
  background: #fff;
  color: #6659d8;
}

.calendar-note-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 1px solid #eee6dc;
  border-radius: 8px;
  background: #fffaf3;
  color: #815f3e;
  text-align: left;
  font-size: 12px;
}

.calendar-note-item span {
  color: #b98b59;
}

.calendar-dialog-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-add-note-button {
  padding: 7px 9px;
  border: 1px solid #e8dbc9;
  border-radius: 7px;
  background: #fff;
  color: #956d47;
  font-size: 11px;
}

.calendar-quick-add-dialog {
  width: min(360px, calc(100% - 35px));
}

.calendar-quick-add-dialog section {
  position: relative;
  display: grid;
  gap: 12px;
}

.calendar-quick-add-dialog h2 {
  margin: 0;
  font-size: 20px;
}

.calendar-quick-add-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.calendar-quick-add-options button {
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: #596277;
  font-size: 12px;
}

.calendar-quick-add-options button:hover {
  border-color: #dcd7fb;
  background: #faf9ff;
  color: #5f52d2;
}

.report-output-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.report-output-actions .report-copy-button {
  flex: 1;
  width: auto;
}

.report-note-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #ddd8fb;
  border-radius: 8px;
  background: #fff;
  color: #6255d2;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.report-note-button:hover:not(:disabled) {
  border-color: #bdb3f4;
  background: #f7f5ff;
  color: #5043bd;
}

.report-note-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

@media (max-width: 980px) {
  .notes-layout.has-detail { grid-template-columns: 220px minmax(0, 1fr); }
  .notes-detail-panel { padding: 28px; }
}

@media (max-width: 700px) {
  .notes-section { margin-top: 38px; }
  .notes-heading { align-items: flex-end; }
  .notes-layout { display: block; min-height: 0; overflow: visible; }
  .notes-layout.has-detail .notes-list-panel { max-height: 250px; border-right: 0; border-bottom: 1px solid var(--line); }
  .notes-detail-panel { padding: 24px 18px; }
  .note-markdown-editor { min-height: 340px; }
  .note-format-toolbar .note-ai-button { margin-left: 0; }
  .calendar-day-open { min-height: 72px; }
  .calendar-quick-add { top: 4px; right: 4px; width: 21px; height: 21px; }
  .report-output-actions { align-items: stretch; flex-direction: column; }
}
