* { box-sizing: border-box; }
:root {
  font-family: Inter, Arial, sans-serif;
  color: #171717;
  background: #f3f3f3;
  color-scheme: light;
}
body {
  margin: 0;
  min-height: 100vh;
  background: #f3f3f3;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.notes-header {
  border-top: 4px solid #df0038;
  border-bottom: 1px solid #d7d2cf;
  background: #fff;
}
.notes-header-inner {
  width: min(1180px, calc(100% - 40px));
  min-height: 118px;
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}
.notes-back {
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #cbc6c2;
  background: #fff;
  color: #171717;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}
.notes-back:hover { background: #f5f3f2; }
.notes-heading { min-width: 0; }
.notes-eyebrow {
  margin: 0 0 5px;
  color: #df0038;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
}
.notes-heading h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.1;
  letter-spacing: -.025em;
}
.notes-heading > p:last-child {
  margin: 6px 0 0;
  color: #6b6662;
  font-size: 12px;
}
.notes-header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.notes-header-actions .notes-back {
  margin-right: auto;
}

.notes-button {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #c9c4c0;
  background: #fff;
  color: #171717;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.notes-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.notes-button:hover { background: #f2f1f0; }
.notes-button-primary {
  border-color: #111;
  background: #111;
  color: #fff;
}
.notes-button-primary:hover { background: #2a2a2a; }
.notes-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.notes-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 24px auto 60px;
}

.notes-toolbar {
  min-height: 58px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #d7d2cf;
  background: #fff;
}
.notes-search {
  width: min(460px, 100%);
  min-height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #cbc6c2;
  background: #fff;
}
.notes-search svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #555;
  stroke-width: 1.7;
}
.notes-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: #171717;
  font-size: 13px;
}
.notes-status-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #6e6864;
  font-size: 11px;
}
.notes-status-wrap strong { color: #171717; font-size: 12px; }

.notes-category-filters {
  margin: 12px 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.notes-filter {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #cfcac7;
  background: #fff;
  color: #4d4946;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.notes-filter:hover { border-color: #9b9692; }
.notes-filter.is-active {
  border-color: #171717;
  background: #171717;
  color: #fff;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.note-card {
  min-height: 220px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  border: 1px solid #d3ceca;
  border-top: 3px solid #df0038;
  background: #fff;
  box-shadow: 0 3px 12px rgba(0,0,0,.035);
}
.note-card.is-pinned { border-top-width: 5px; }
.note-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.note-category {
  max-width: calc(100% - 34px);
  padding: 4px 7px;
  overflow: hidden;
  border: 1px solid #ddd8d5;
  background: #f7f6f5;
  color: #625d59;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.note-pin-button {
  width: 30px;
  height: 30px;
  margin-left: auto;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #8a8581;
  cursor: pointer;
}
.note-pin-button.is-pinned { color: #df0038; }
.note-pin-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.note-card h2 {
  margin: 13px 0 8px;
  font-size: 17px;
  line-height: 1.25;
}
.note-card-content {
  margin: 0;
  max-height: 11.5em;
  overflow: hidden;
  color: #5c5753;
  font-size: 12px;
  line-height: 1.5;
}

.note-picture-gallery {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.note-picture-thumb {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid #ddd8d5;
  background: #f4f4f4;
  text-decoration: none;
}
.note-picture-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.note-picture-more {
  display: grid;
  place-items: center;
  color: #5b5652;
  font-size: 11px;
  font-weight: 800;
}

.daily-note-card .note-card-content.is-empty {
  color: #8a8581;
  font-style: italic;
}
.daily-note-category {
  color: #a6002b;
  border-color: #e5bcc6;
  background: #fff4f6;
}
.note-card-footer {
  margin-top: auto;
  padding-top: 15px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-top: 1px solid #ece9e7;
}
.note-updated {
  margin-right: auto;
  color: #8a8581;
  font-size: 9.5px;
}
.note-card-action {
  min-height: 31px;
  padding: 0 9px;
  border: 1px solid #d2cdca;
  background: #fff;
  color: #383431;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.note-card-action:hover { background: #f2f1f0; }
.note-card-action.delete:hover {
  border-color: #df0038;
  color: #c70032;
}

.notes-empty[hidden],
.notes-grid[hidden] {
  display: none !important;
}

.notes-empty {
  min-height: 340px;
  padding: 54px 20px;
  display: grid;
  justify-items: center;
  align-content: center;
  border: 1px solid #d7d2cf;
  background: #fff;
  text-align: center;
}
.notes-empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f3f1f0;
}
.notes-empty-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: #df0038;
  stroke-width: 1.6;
}
.notes-empty h2 { margin: 13px 0 5px; font-size: 19px; }
.notes-empty p { max-width: 440px; margin: 0 0 18px; color: #6e6864; font-size: 12px; line-height: 1.5; }

.notes-dialog {
  width: min(660px, calc(100vw - 28px));
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: 0 22px 70px rgba(0,0,0,.25);
}
.notes-dialog::backdrop {
  background: rgba(25,23,22,.56);
  backdrop-filter: blur(2px);
}
.notes-dialog-card {
  max-height: calc(100vh - 28px);
  padding: 24px;
  overflow: auto;
  border-top: 4px solid #df0038;
  background: #fff;
}
.notes-dialog-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.notes-dialog-heading h2 { margin: 0; font-size: 24px; }
.notes-dialog-close {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #222;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.notes-dialog-copy {
  margin: -5px 0 16px;
  color: #6b6662;
  font-size: 12px;
  line-height: 1.45;
}
.notes-field {
  margin-top: 13px;
  display: grid;
  gap: 6px;
}
.notes-field > span {
  color: #403b38;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.notes-field input,
.notes-field textarea,
.notes-select-wrap select,
.category-add-row input,
.category-row input {
  width: 100%;
  border: 1px solid #cbc6c2;
  background: #fff;
  color: #171717;
  outline: 0;
}
.notes-field input,
.notes-select-wrap select,
.category-add-row input,
.category-row input {
  min-height: 42px;
  padding: 0 12px;
}
.notes-field textarea {
  min-height: 210px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.5;
}

.rich-note-editor {
  overflow: hidden;
  border: 1px solid #cbc6c2;
  background: #fff;
}
.rich-note-editor:focus-within {
  border-color: #171717;
  box-shadow: 0 0 0 2px rgba(23,23,23,.07);
}
.rich-note-toolbar {
  min-height: 42px;
  padding: 5px 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  border-bottom: 1px solid #ddd8d5;
  background: #f7f7f7;
  scrollbar-width: none;
}
.rich-note-toolbar::-webkit-scrollbar { display: none; }
.rich-note-tool {
  min-width: 34px;
  height: 31px;
  padding: 0 8px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: transparent;
  color: #262321;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}
.rich-note-tool:hover,
.rich-note-tool:focus-visible {
  border-color: #cbc6c2;
  background: #fff;
}
.rich-note-tool.is-active {
  border-color: #aaa4a0;
  background: #e9e7e5;
  color: #111;
}
.rich-note-toolbar-divider {
  width: 1px;
  height: 22px;
  margin: 0 3px;
  flex: 0 0 1px;
  background: #d8d3cf;
}
.rich-note-surface {
  min-height: 210px;
  max-height: 420px;
  padding: 12px;
  overflow-y: auto;
  outline: 0;
  color: #171717;
  font-size: 13px;
  line-height: 1.55;
  white-space: normal;
}
.rich-note-surface:empty::before {
  content: attr(data-placeholder);
  color: #8a8581;
  pointer-events: none;
}
.rich-note-surface p,
.rich-note-display p {
  margin: 0 0 .7em;
}
.rich-note-surface p:last-child,
.rich-note-display p:last-child {
  margin-bottom: 0;
}
.rich-note-surface h2,
.rich-note-display h2 {
  margin: .45em 0 .35em;
  font-size: 1.45em;
  line-height: 1.25;
}
.rich-note-surface h3,
.rich-note-display h3 {
  margin: .4em 0 .3em;
  font-size: 1.22em;
  line-height: 1.3;
}
.rich-note-surface ul,
.rich-note-surface ol,
.rich-note-display ul,
.rich-note-display ol {
  margin: .45em 0 .65em;
  padding-left: 1.6em;
}
.rich-note-surface li,
.rich-note-display li {
  margin: .15em 0;
}
.rich-note-surface a,
.rich-note-display a {
  color: #a6002b;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.rich-note-display strong,
.rich-note-display b { font-weight: 750; }
.rich-note-display u { text-underline-offset: 2px; }
.notes-field input:focus,
.notes-field textarea:focus,
.notes-select-wrap select:focus,
.category-add-row input:focus,
.category-row input:focus {
  border-color: #171717;
  box-shadow: 0 0 0 2px rgba(23,23,23,.07);
}
.notes-select-wrap { position: relative; }
.notes-select-wrap select {
  padding-right: 38px;
  appearance: none;
  -webkit-appearance: none;
}
.notes-select-wrap > span {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #555;
  border-bottom: 1.5px solid #555;
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

.note-picture-field {
  margin-top: 14px;
  display: grid;
  gap: 9px;
}
.note-picture-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.note-picture-field-head > span {
  color: #403b38;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.note-picture-field-head small {
  color: #7b7571;
  font-size: 9.5px;
  line-height: 1.3;
  text-align: right;
}
.note-picture-picker {
  min-height: 42px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px dashed #aaa4a0;
  background: #fafafa;
  color: #383431;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.note-picture-picker:hover,
.note-picture-picker:focus-within {
  border-color: #171717;
  background: #f4f4f4;
}
.note-picture-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
.note-picture-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.note-picture-edit-item {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid #d7d2cf;
  background: #f3f3f3;
}
.note-picture-edit-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.note-picture-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(17,17,17,.88);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.note-picture-file-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 5px 6px;
  overflow: hidden;
  background: rgba(17,17,17,.72);
  color: #fff;
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-pin-option {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #4f4a47;
  font-size: 11px;
  font-weight: 600;
}
.notes-pin-option input { width: 17px; height: 17px; accent-color: #df0038; }
.notes-dialog-message { min-height: 17px; margin: 10px 0 0; color: #b0002d; font-size: 10px; }
.notes-dialog-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.category-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.category-manager-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}
.category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 7px;
  align-items: center;
}
.category-delete {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #cbc6c2;
  background: #fff;
  color: #666;
  cursor: pointer;
}
.category-delete:hover { border-color: #df0038; color: #df0038; }
.category-delete svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.category-delete:disabled { opacity: .35; cursor: not-allowed; }

@media (max-width: 900px) {
  .notes-header-inner {
    gap: 14px;
    padding: 16px 0;
  }
  .notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 580px) {
  .notes-header-inner,
  .notes-shell { width: calc(100% - 24px); }
  .notes-header-inner { min-height: 0; }
  .notes-heading h1 { font-size: 25px; }
  .notes-header-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }
  .notes-header-actions .notes-back {
    margin-right: 0;
  }
  .notes-header-actions .notes-back,
  .notes-header-actions .notes-button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
    font-size: 10.5px;
    white-space: nowrap;
  }
  .notes-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .notes-search { width: 100%; }
  .notes-status-wrap { width: 100%; margin-left: 0; justify-content: space-between; }
  .notes-grid { grid-template-columns: 1fr; }
  .note-card { min-height: 190px; }
  .rich-note-toolbar { padding-inline: 4px; gap: 2px; }
  .rich-note-tool { min-width: 32px; padding-inline: 7px; }
  .rich-note-surface { min-height: 190px; max-height: 350px; }
  .note-picture-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note-picture-field-head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .note-picture-field-head small { text-align: left; }
  .notes-dialog-card { padding: 18px; }
}


/* Refined rich-text editor toolbar */
.rich-note-editor {
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,.025);
}

.rich-note-toolbar {
  min-height: 48px;
  padding: 6px 8px;
  gap: 5px;
  background: #fafafa;
}

.rich-note-tool {
  width: 36px;
  min-width: 36px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 3px;
  font-size: 13px;
  line-height: 1;
}

.rich-note-tool strong,
.rich-note-tool em,
.rich-note-tool u {
  font-size: 14px;
}

.rich-note-tool-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rich-note-heading-tool {
  width: 42px;
  min-width: 42px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.rich-note-tool:hover,
.rich-note-tool:focus-visible {
  border-color: #bdb7b3;
  background: #fff;
}

.rich-note-tool.is-active {
  border-color: #9d9793;
  background: #eceae8;
}

.rich-note-toolbar-divider {
  height: 26px;
  margin: 0 2px;
}

.rich-note-surface {
  min-height: 190px;
  padding: 14px 15px;
  font-size: 13.5px;
  line-height: 1.6;
}

@media (max-width: 580px) {
  .rich-note-toolbar {
    min-height: 46px;
    padding: 5px 6px;
    gap: 3px;
  }

  .rich-note-tool {
    width: 34px;
    min-width: 34px;
    height: 34px;
  }

  .rich-note-heading-tool {
    width: 38px;
    min-width: 38px;
  }

  .rich-note-toolbar-divider {
    margin-inline: 1px;
  }

  .rich-note-surface {
    min-height: 175px;
    padding: 12px 13px;
  }
}
