:root {
  --notes-bg: #121212;
  --notes-surface: #1e1e1e;
  --notes-surface-raised: #252525;
  --notes-border: #343434;
  --notes-text: #f5f5f7;
  --notes-muted: #a0a0a6;
  --notes-accent: #7c9cf5;
  --notes-accent-strong: #6689ec;
  --notes-danger: #ef8d8d;
}

#screen-notes,
#screen-notes-editor {
  background: var(--notes-bg);
}

#screen-notes .scroll-area,
#screen-notes-editor .scroll-area {
  max-width: none !important;
  padding: 0 !important;
  background: var(--notes-bg);
}

.notes-app,
.notes-editor {
  box-sizing: border-box;
  width: min(100%, 980px);
  min-height: 100%;
  margin: 0 auto;
  color: var(--notes-text);
  font-family: 'Nunito', sans-serif;
}

.notes-app {
  position: relative;
  padding: 0 24px 112px;
}

.notes-main-header,
.notes-editor-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  min-height: 76px;
  background: color-mix(in srgb, var(--notes-bg) 94%, transparent);
  border-bottom: 1px solid var(--notes-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.notes-main-header h1 {
  min-width: 0;
  margin: 0 !important;
  overflow: hidden;
  color: var(--notes-text) !important;
  font-size: 21px !important;
  font-weight: 800 !important;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-icon-btn {
  display: inline-grid !important;
  width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  place-items: center;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: var(--notes-muted) !important;
  cursor: pointer;
}

.notes-icon-btn svg,
.notes-fab svg,
.notes-empty-icon svg,
.note-add-item svg,
.note-item-remove svg,
.notes-search-field svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.notes-icon-btn:hover,
.notes-icon-btn:focus-visible,
.notes-icon-btn.is-active {
  background: var(--notes-surface-raised) !important;
  color: var(--notes-text) !important;
}

.notes-icon-btn:focus-visible,
.notes-fab:focus-visible,
.note-card:focus-visible,
.note-add-item:focus-visible {
  outline: 2px solid var(--notes-accent);
  outline-offset: 2px;
}

.notes-icon-btn:active,
.notes-fab:active,
.note-card:active {
  transform: scale(.96);
}

.notes-delete-icon:hover,
.notes-delete-icon:focus-visible {
  color: var(--notes-danger) !important;
}

.notes-search-wrap {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows .2s ease, opacity .16s ease;
}

.notes-search-wrap.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
}

.notes-search-field {
  display: flex;
  min-height: 0;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  color: var(--notes-muted);
}

.notes-search-field svg {
  width: 20px;
  height: 20px;
  margin-left: 14px;
}

.notes-search {
  width: 100%;
  height: 48px;
  margin: 12px 0;
  padding: 0 14px 0 0 !important;
  border: 0 !important;
  outline: 0;
  background: var(--notes-surface-raised) !important;
  color: var(--notes-text) !important;
  font: 600 15px 'Nunito', sans-serif !important;
}

.notes-search-field:focus-within {
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--notes-accent);
  background: var(--notes-surface-raised);
}

.notes-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 0 0;
}

.note-card {
  min-width: 0;
  min-height: 142px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--notes-border);
  border-radius: 12px;
  background: var(--notes-surface);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background-color .16s ease;
}

.note-card:hover {
  border-color: #505050;
  background: var(--notes-surface-raised);
}

.note-card h2 {
  margin: 0 0 8px !important;
  overflow: hidden;
  color: var(--notes-text) !important;
  font-size: 17px !important;
  font-weight: 800 !important;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.note-card p {
  display: -webkit-box;
  min-height: 42px;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--notes-muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.note-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  color: #77777d;
  font-size: 11px;
}

.note-tag {
  display: block;
  max-width: 75%;
  padding: 4px 8px;
  overflow: hidden;
  border: 1px solid var(--notes-border);
  border-radius: 999px;
  color: var(--notes-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-fab {
  position: fixed;
  right: 30px;
  bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 900;
  display: grid;
  width: 62px;
  height: 62px;
  min-height: 62px !important;
  padding: 0 !important;
  place-items: center;
  border: 0 !important;
  border-radius: 50% !important;
  background: var(--notes-accent) !important;
  color: #101114 !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .38);
  cursor: pointer;
}

.notes-fab:hover {
  background: var(--notes-accent-strong) !important;
}

.notes-fab svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.2;
}

.notes-empty {
  grid-column: 1 / -1;
  display: flex;
  min-height: 52vh;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  color: var(--notes-muted);
  text-align: center;
}

.notes-empty-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 8px;
  place-items: center;
  border: 1px solid var(--notes-border);
  border-radius: 50%;
}

.notes-empty strong {
  color: var(--notes-text);
  font-size: 16px;
}

.notes-empty > span:last-child {
  font-size: 13px;
}

.notes-editor {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  padding: 0 28px;
}

.notes-editor-header {
  grid-template-columns: 48px minmax(0, 1fr) auto;
}

.notes-editor-actions {
  grid-column: 3;
  display: flex;
  align-items: center;
  gap: 5px;
}

.notes-editor-content {
  flex: 1;
  padding: 28px 4px 20px;
}

.note-title-input,
.note-content-input,
.note-tag-input,
.note-item-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0;
  background: transparent !important;
  color: var(--notes-text) !important;
  font-family: 'Nunito', sans-serif !important;
}

.note-title-input {
  padding: 0 0 18px !important;
  font-size: 30px !important;
  font-weight: 800 !important;
  line-height: 1.25;
}

.note-title-input::placeholder,
.note-content-input::placeholder,
.note-tag-input::placeholder,
.note-item-input::placeholder,
.notes-search::placeholder {
  color: #707076;
  opacity: 1;
}

.note-editor-body {
  flex: 1;
}

.note-content-input {
  min-height: 58vh !important;
  padding: 0 !important;
  resize: none;
  font-size: 17px !important;
  line-height: 1.65;
}

.notes-editor-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  border-top: 1px solid var(--notes-border);
  background: var(--notes-bg);
  padding: 10px 4px max(14px, env(safe-area-inset-bottom));
}

.note-tag-input {
  padding: 8px 0 !important;
  color: var(--notes-muted) !important;
  font-size: 14px !important;
}

.note-checklist-editor {
  display: grid;
  gap: 4px;
}

.note-check-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.note-check-item input[type='checkbox'] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.note-checkmark {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 2px solid var(--notes-muted);
  border-radius: 5px;
  cursor: pointer;
}

.note-check-item input[type='checkbox']:checked + .note-checkmark {
  border-color: var(--notes-accent);
  background: var(--notes-accent);
}

.note-check-item input[type='checkbox']:checked + .note-checkmark::after {
  width: 8px;
  height: 4px;
  border-bottom: 2px solid #101114;
  border-left: 2px solid #101114;
  content: '';
  transform: translateY(-1px) rotate(-45deg);
}

.note-check-item input[type='checkbox']:focus-visible + .note-checkmark {
  outline: 2px solid var(--notes-accent);
  outline-offset: 3px;
}

.note-item-input {
  min-width: 0;
  padding: 11px 0 !important;
  border-bottom: 1px solid var(--notes-border) !important;
  font-size: 16px !important;
}

.note-check-item.is-completed .note-item-input {
  color: var(--notes-muted) !important;
  text-decoration: line-through;
  opacity: .48;
}

.note-item-remove {
  display: grid;
  width: 36px;
  height: 36px;
  min-height: 36px !important;
  padding: 0 !important;
  place-items: center;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: #77777d !important;
  cursor: pointer;
}

.note-item-remove svg {
  width: 18px;
  height: 18px;
}

.note-item-remove:hover {
  color: var(--notes-text) !important;
}

.note-add-item {
  display: inline-flex;
  width: max-content;
  min-height: 40px !important;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0 34px;
  padding: 0 10px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: var(--notes-muted) !important;
  font: 700 13px 'Nunito', sans-serif !important;
  cursor: pointer;
}

.note-add-item:hover {
  background: var(--notes-surface-raised) !important;
  color: var(--notes-text) !important;
}

.note-add-item svg {
  width: 18px;
  height: 18px;
}

.notes-toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 2500;
  display: flex;
  width: max-content;
  max-width: calc(100vw - 28px);
  align-items: center;
  gap: 18px;
  padding: 14px 14px 14px 18px;
  border: 1px solid #454545;
  border-radius: 10px;
  background: #292929;
  color: var(--notes-text);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .5);
  font: 600 13px 'Nunito', sans-serif;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 140%);
  transition: transform .22s ease, opacity .18s ease;
}

.notes-toast.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.notes-toast button {
  min-height: 34px !important;
  padding: 0 8px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--notes-accent) !important;
  font: 900 12px 'Nunito', sans-serif !important;
  cursor: pointer;
  white-space: nowrap;
}

@media (min-width: 1180px) {
  body.has-sidebar:not(.sidebar-collapsed) .notes-fab {
    right: 42px;
  }
}

@media (max-width: 700px) {
  .notes-app {
    padding: 0 14px 104px;
  }

  .notes-main-header,
  .notes-editor-header {
    min-height: 66px;
  }

  .notes-main-header h1 {
    font-size: 19px !important;
  }

  .notes-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
    padding-top: 14px;
  }

  .note-card {
    min-height: 126px;
    padding: 16px;
  }

  .notes-fab {
    right: 20px;
    bottom: max(22px, env(safe-area-inset-bottom));
    width: 58px;
    height: 58px;
    min-height: 58px !important;
  }

  .notes-editor {
    padding: 0 18px;
  }

  .notes-editor-content {
    padding-top: 24px;
  }

  .note-title-input {
    font-size: 26px !important;
  }

  .note-content-input {
    min-height: 62vh !important;
    font-size: 16px !important;
  }

  .notes-toast {
    bottom: max(16px, env(safe-area-inset-bottom));
    gap: 10px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .notes-search-wrap,
  .notes-toast,
  .note-card,
  .notes-icon-btn,
  .notes-fab {
    transition: none;
  }
}