/* MyNotes — Google Keep–style notes. Loaded only on the notes page (after app.css). */

/* Note colours (Keep's palette), light and dark. */
:root {
  --note-default: var(--surface);
  --note-red: #faafa8;
  --note-orange: #f39f76;
  --note-yellow: #fff8b8;
  --note-green: #e2f6d3;
  --note-teal: #b4ddd3;
  --note-blue: #d4e4ed;
  --note-darkblue: #aeccdc;
  --note-purple: #d3bfdb;
  --note-pink: #f6e2dd;
  --note-brown: #e9e3d4;
  --note-gray: #efeff1;
  --note-ink: #202124;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --note-red: #77172e;
    --note-orange: #692b17;
    --note-yellow: #7c4a03;
    --note-green: #264d3b;
    --note-teal: #0c625d;
    --note-blue: #256377;
    --note-darkblue: #284255;
    --note-purple: #472e5b;
    --note-pink: #6c394f;
    --note-brown: #4b443a;
    --note-gray: #232427;
    --note-ink: #e8eaed;
  }
}

[data-color] { --note-bg: var(--note-default); }
[data-color="red"] { --note-bg: var(--note-red); }
[data-color="orange"] { --note-bg: var(--note-orange); }
[data-color="yellow"] { --note-bg: var(--note-yellow); }
[data-color="green"] { --note-bg: var(--note-green); }
[data-color="teal"] { --note-bg: var(--note-teal); }
[data-color="blue"] { --note-bg: var(--note-blue); }
[data-color="darkblue"] { --note-bg: var(--note-darkblue); }
[data-color="purple"] { --note-bg: var(--note-purple); }
[data-color="pink"] { --note-bg: var(--note-pink); }
[data-color="brown"] { --note-bg: var(--note-brown); }
[data-color="gray"] { --note-bg: var(--note-gray); }

/* ---------- Page ---------- */
.notes {
  --notes-col: 240px;
}

.notes-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.notes-search {
  position: relative;
  flex: 1;
  max-width: 720px;
}

.notes-search .icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.notes-search .input {
  padding-left: 2.5rem;
  border-radius: var(--r-pill);
  background: var(--surface-2);
}

.notes-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--s-5);
  align-items: start;
}

/* ---------- Side navigation ---------- */
.notes-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.notes-nav__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 0;
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.notes-nav__item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-nav__item:hover {
  background: var(--surface-2);
}

.notes-nav__item[aria-current="page"] {
  background: var(--purple-100);
  color: var(--purple-deep);
}

@media (max-width: 899px) {
  .notes-body {
    grid-template-columns: 1fr;
    gap: var(--s-3);
  }

  .notes-nav {
    overflow-x: auto;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
    scrollbar-width: none;
  }

  .notes-nav ul {
    display: flex;
    gap: var(--s-2);
  }

  .notes-nav__item {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    white-space: nowrap;
  }
}

/* ---------- Composer ---------- */
.notes-composer {
  max-width: 600px;
  margin: 0 auto var(--s-6);
}

.notes-composer__closed {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding: 0.35rem 0.5rem 0.35rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.notes-composer__start {
  flex: 1;
  padding: 0.6rem 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: text;
}

.notes-composer .note-editor {
  box-shadow: var(--shadow-2);
}

/* ---------- Editor (composer and dialog) ---------- */
.note-editor {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--note-bg);
  color: var(--ink);
  overflow: hidden;
}

.note-editor:not([data-color="default"]) {
  border-color: transparent;
  color: var(--note-ink);
}

.note-editor__head {
  display: flex;
  align-items: flex-start;
  padding: var(--s-3) var(--s-2) 0 var(--s-4);
}

.note-editor__title,
.note-editor__text,
.note-editor__item-text {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  outline: none;
}

.note-editor__title {
  flex: 1;
  padding: 0.35rem 0;
  font-size: var(--fs-md);
  font-weight: 600;
}

.note-editor__title::placeholder,
.note-editor__text::placeholder,
.note-editor__item-text::placeholder {
  color: inherit;
  opacity: 0.6;
}

.note-editor__pin[aria-pressed="true"] {
  color: var(--purple-deep);
}

.note-editor__body {
  padding: 0 var(--s-4);
}

.note-editor__text {
  display: block;
  min-height: 3rem;
  max-height: 60vh;
  padding: var(--s-2) 0;
  resize: none;
  line-height: 1.5;
}

.note-editor__items {
  margin: 0;
  padding: var(--s-1) 0;
  list-style: none;
}

.note-editor__item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 2.1rem;
}

.note-editor__item .btn {
  opacity: 0;
}

.note-editor__item:hover .btn,
.note-editor__item:focus-within .btn {
  opacity: 1;
}

.note-editor__item input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  accent-color: var(--purple-deep);
}

.note-editor__item.is-done .note-editor__item-text {
  text-decoration: line-through;
  opacity: 0.65;
}

.note-editor__item--add {
  color: var(--muted);
}

.note-editor__item--add .icon {
  width: 1.05rem;
  flex: none;
}

.note-editor__done {
  border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent);
  margin-top: var(--s-2);
  padding-top: var(--s-2);
}

.note-editor__done summary {
  cursor: pointer;
  font-size: var(--fs-sm);
  opacity: 0.75;
}

.note-editor__images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.note-editor__image {
  position: relative;
  margin: 0;
}

.note-editor__image img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}

.note-editor__image-del {
  position: absolute;
  right: var(--s-2);
  bottom: var(--s-2);
  background: var(--surface);
  opacity: 0;
}

.note-editor__image:hover .note-editor__image-del,
.note-editor__image-del:focus-visible {
  opacity: 1;
}

.note-editor .note-chips {
  padding: var(--s-2) var(--s-4) 0;
}

.note-editor__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: var(--s-2);
}

.note-editor__tools .btn {
  color: inherit;
}

.note-editor__spacer {
  flex: 1;
}

.note-editor__edited {
  font-size: var(--fs-xs);
  margin-right: var(--s-2);
  color: inherit;
  opacity: 0.7;
}

/* ---------- Dialog ---------- */
.notes-modal {
  width: min(640px, calc(100vw - 2 * var(--gutter)));
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  box-shadow: var(--shadow-3);
}

.notes-modal .note-editor {
  border: 0;
}

/* ---------- Cards ---------- */
.notes-heading {
  margin: var(--s-4) 0 var(--s-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notes-grid {
  columns: var(--notes-col);
  column-gap: var(--s-4);
}

[data-layout="list"] .notes-grid {
  columns: 1;
  max-width: 600px;
  margin: 0 auto;
}

[data-layout="list"] .notes-heading {
  max-width: 600px;
  margin-inline: auto;
}

.note-card {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--note-bg);
  color: var(--ink);
  overflow: hidden;
  break-inside: avoid;
  cursor: default;
  transition: box-shadow var(--t-fast) var(--ease-out);
}

.note-card:not([data-color="default"]) {
  border-color: transparent;
  color: var(--note-ink);
}

.note-card[tabindex] {
  cursor: pointer;
}

.note-card:hover,
.note-card:focus-visible {
  box-shadow: var(--shadow-2);
}

.note-card:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.note-card__content {
  padding: var(--s-3) var(--s-4) var(--s-2);
}

.note-card__title {
  margin: 0 1.75rem var(--s-2) 0;
  font-size: var(--fs-base);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.note-card__text {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-line-clamp: 12;
  -webkit-box-orient: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.note-card__list ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.note-card__list li {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: 2px 0;
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.note-card__list input {
  margin-top: 0.2rem;
  accent-color: var(--purple-deep);
}

.note-card__list p,
.note-card__done {
  margin: var(--s-1) 0 0;
  font-size: var(--fs-xs);
  color: inherit;
  opacity: 0.75;
}

.note-card__images {
  display: grid;
  gap: 2px;
}

.note-card__images--2 { grid-template-columns: 1fr 1fr; }
.note-card__images--3 { grid-template-columns: 2fr 1fr 1fr; }

.note-card__images img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 260px;
  object-fit: cover;
}

.note-card__pin {
  position: absolute;
  top: var(--s-1);
  right: var(--s-1);
  color: inherit;
  opacity: 0;
}

.note-card__pin.is-pinned {
  opacity: 1;
  color: var(--purple-deep);
}

.note-card__tools {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  padding: 0 var(--s-1) var(--s-1);
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease-out);
}

.note-card__tools .btn {
  color: inherit;
}

.note-card:hover .note-card__pin,
.note-card:hover .note-card__tools,
.note-card:focus-within .note-card__pin,
.note-card:focus-within .note-card__tools {
  opacity: 1;
}

/* Touch screens have no hover: keep the tools visible. */
@media (hover: none) {
  .note-card__tools,
  .note-card__pin {
    opacity: 1;
  }
}

/* ---------- Chips ---------- */
.note-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  margin-top: var(--s-2);
}

.note-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 0.6rem;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  background: color-mix(in srgb, currentColor 6%, transparent);
}

.note-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-chip .icon {
  width: 0.85rem;
  height: 0.85rem;
  flex: none;
}

.note-chip.is-past span {
  text-decoration: line-through;
}

.note-chip__x {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

/* ---------- Popovers (colour, reminder, labels, more) ---------- */
.notes-pop {
  position: fixed;
  inset: auto;
  z-index: 2000; /* above note windows where the Popover API is missing */
  margin: 0;
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  animation: pop-in 0.16s var(--ease-out);
  min-width: 220px;
  max-width: min(320px, calc(100vw - 16px));
  padding: var(--s-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-3);
}

.notes-colors {
  display: grid;
  grid-template-columns: repeat(6, 2rem);
  gap: var(--s-2);
}

.notes-swatch {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--note-bg);
  color: var(--note-ink);
  cursor: pointer;
}

.notes-swatch[data-color="default"] {
  background: var(--surface);
  color: var(--ink);
}

.notes-swatch.is-current,
.notes-swatch:hover {
  border-color: var(--purple);
}

.notes-menu {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* the date input must not widen the panel */
  gap: 2px;
}

.notes-menu__title {
  margin: 0 0 var(--s-1);
  padding: 0 var(--s-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.notes-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  width: 100%;
  padding: 0.5rem var(--s-2);
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
}

.notes-menu__item .icon {
  flex: none;
}

.notes-menu__item:has(.icon) {
  justify-content: flex-start;
}

.notes-menu__item:hover,
.notes-menu__item:focus-visible {
  background: var(--surface-2);
}

.notes-menu__item--danger {
  color: var(--danger);
}

.notes-menu__custom {
  display: flex;
  gap: var(--s-2);
  padding: var(--s-2);
  border-top: 1px solid var(--border);
  margin-top: var(--s-1);
}

.notes-menu__custom .input {
  min-width: 0;
}

.notes-menu__labels {
  display: grid;
  max-height: 240px;
  overflow-y: auto;
  margin-top: var(--s-2);
}

.notes-menu__check {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0.4rem var(--s-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  cursor: pointer;
}

.notes-menu__check:hover {
  background: var(--surface-2);
}

/* ---------- Banners, trash bar, empty state ---------- */
.notes-push,
.notes-trashbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  max-width: 600px;
  margin: 0 auto var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
}

.notes-push {
  background: var(--info-bg);
}

/* Long text: icon, text and button on one row where there is room. */
.notes-push--local,
.notes-push[data-notes-import] {
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.notes-push--local > span,
.notes-push[data-notes-import] > span {
  flex: 1;
}

@media (max-width: 560px) {
  .notes-push--local,
  .notes-push[data-notes-import] {
    flex-wrap: wrap;
  }
}

.notes-trashbar {
  font-style: italic;
  color: var(--muted);
}

.notes-empty {
  display: grid;
  justify-items: center;
  gap: var(--s-3);
  padding: var(--s-8) var(--s-4);
  color: var(--muted);
  text-align: center;
}

.notes-empty__icon .icon {
  width: 5rem;
  height: 5rem;
  opacity: 0.35;
}

.notes-empty p {
  margin: 0;
  font-size: var(--fs-lg);
}

.notes-loading {
  text-align: center;
}

/* ---------- Labels dialog ---------- */
.notes-labels__new {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}

.notes-labels__list {
  display: grid;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.notes-labels__item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

@media (prefers-reduced-motion: reduce) {
  .note-card,
  .note-card__tools {
    transition: none;
  }
}

/* ---------- Motion: popovers, sheets, checklist rows ---------- */
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
  }
}

@keyframes pop-out {
  to {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

@keyframes sheet-out {
  to {
    transform: translateY(100%);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.notes-pop.is-closing {
  animation: pop-out 0.14s ease-in forwards;
  pointer-events: none;
}

/* Phones: menus and pickers are bottom sheets. */
.notes-pop.is-sheet {
  top: auto !important;
  right: 0;
  bottom: 0;
  left: 0 !important;
  width: 100%;
  max-width: none;
  max-height: 85dvh;
  padding-bottom: calc(var(--s-3) + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  animation: sheet-in 0.26s var(--ease-out);
}

.notes-pop.is-sheet.is-closing {
  animation: sheet-out 0.2s ease-in forwards;
}

.note-editor__item.is-new {
  animation: fade-up 0.2s var(--ease-out);
}

/* ---------- Cards: drag to reorder ---------- */
.note-card {
  -webkit-touch-callout: none;
  user-select: none;
}

.note-card.is-dragging {
  position: fixed;
  z-index: 1500;
  margin: 0;
  box-shadow: 0 22px 48px rgba(14, 18, 34, 0.28);
  transform: rotate(1.5deg) scale(1.03);
  cursor: grabbing;
  pointer-events: none;
  transition: transform var(--t-fast) var(--ease-out);
}

.note-card--placeholder {
  border: 2px dashed var(--border-strong);
  background: color-mix(in srgb, var(--purple) 6%, transparent);
  box-shadow: none;
}

.note-card--ghost {
  position: fixed;
  z-index: 40;
  margin: 0;
  pointer-events: none;
}

/* ---------- Floating note windows ---------- */
.note-win {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  min-width: 280px;
  min-height: 220px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--note-bg);
  color: var(--ink);
  box-shadow: 0 14px 40px rgba(14, 18, 34, 0.18), 0 2px 6px rgba(14, 18, 34, 0.1);
  overflow: hidden;
  resize: both;
  transition: box-shadow var(--t-base) var(--ease-out);
}

.note-win:not([data-color="default"]) {
  border-color: transparent;
  color: var(--note-ink);
}

.note-win.is-front {
  box-shadow: 0 24px 60px rgba(14, 18, 34, 0.26), 0 3px 10px rgba(14, 18, 34, 0.12);
}

.note-win.is-dragging {
  box-shadow: 0 30px 70px rgba(14, 18, 34, 0.32);
  user-select: none;
}

.note-win__bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 6px 6px 10px;
  border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
  background: color-mix(in srgb, currentColor 5%, transparent);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.note-win.is-dragging .note-win__bar {
  cursor: grabbing;
}

.note-win__grip {
  flex: none;
  width: 10px;
  height: 16px;
  margin-right: 4px;
  background-image: radial-gradient(currentColor 1.1px, transparent 1.6px);
  background-size: 5px 5px;
  opacity: 0.4;
}

.note-win__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-win__btn {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.note-win__btn .icon {
  width: 16px;
  height: 16px;
}

.note-win__btn:hover,
.note-win__btn:focus-visible {
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.note-win__btn[data-win-close]:hover {
  background: var(--danger);
  color: var(--white);
}

.note-win__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.note-win .note-editor {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.note-win .note-editor__tools {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  background: var(--note-bg);
}

.note-win[data-state="max"] {
  top: 12px !important;
  left: 12px !important;
  width: calc(100vw - 24px) !important;
  height: calc(100dvh - 24px) !important;
  resize: none;
}

.note-win.is-morphing {
  transition: top 0.26s var(--ease-out), left 0.26s var(--ease-out), width 0.26s var(--ease-out), height 0.26s var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}

.note-win.is-opening,
.note-win.is-restoring {
  animation: win-in 0.24s var(--ease-out);
}

.note-win.is-minimising {
  animation: win-min 0.22s ease-in forwards;
  pointer-events: none;
}

.note-win.is-closing {
  animation: win-out 0.2s ease-in forwards;
  pointer-events: none;
}

@keyframes win-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
}

@keyframes win-min {
  to {
    opacity: 0;
    transform: translateY(35vh) scale(0.4);
  }
}

@keyframes win-out {
  to {
    opacity: 0;
    transform: scale(0.94);
  }
}

/* Phones: a full-height sheet from the bottom; drag the bar down to minimise. */
@media (max-width: 640px) {
  .note-win,
  .note-win[data-state="max"] {
    top: auto !important;
    bottom: 0;
    left: 0 !important;
    width: 100% !important;
    height: calc(100dvh - 40px) !important;
    max-width: none;
    border-radius: 18px 18px 0 0;
    resize: none;
  }

  .note-win__bar {
    position: relative;
    padding-top: 16px;
  }

  .note-win__grip {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin: 0;
    border-radius: 2px;
    background: currentColor;
    transform: translateX(-50%);
  }

  .note-win__btn[data-win-max] {
    display: none;
  }

  .note-win.is-opening,
  .note-win.is-restoring {
    animation: sheet-in 0.3s var(--ease-out);
  }

  .note-win.is-minimising,
  .note-win.is-closing {
    animation: sheet-out 0.22s ease-in forwards;
  }
}

/* ---------- Dock of minimised notes ---------- */
.note-dock {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 1900; /* above every note window (they stay below 1800) */
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow-3);
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
  animation: fade-up 0.25s var(--ease-out);
}

.note-dock[hidden] {
  display: none;
}

.note-dock__list {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.note-dock__item {
  display: inline-flex;
  flex: none;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  animation: fade-up 0.22s var(--ease-out);
}

.note-dock__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  padding: 6px 4px 6px 10px;
  border: 0;
  border-radius: var(--r-pill) 0 0 var(--r-pill);
  background: var(--note-bg);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.note-dock__chip:not([data-color="default"]) {
  color: var(--note-ink);
}

.note-dock__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
}

.note-dock__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-dock__x {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.note-dock__x .icon {
  width: 14px;
  height: 14px;
}

.note-dock__x:hover {
  color: var(--danger);
}

.note-dock__open {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient);
  color: var(--white);
}

@media (max-width: 640px) {
  .has-bottom-nav .note-dock {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* ---------- Reminder picker ---------- */
.notes-pop--picker {
  width: 316px;
  max-width: calc(100vw - 16px);
}

.notes-pop--picker.is-sheet {
  width: 100%;
}

.rp {
  display: grid;
  gap: var(--s-2);
}

.rp__quick {
  display: grid;
  gap: 2px;
}

.rp__preset {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 0.55rem 0.6rem;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.rp__preset:hover,
.rp__preset:focus-visible {
  background: color-mix(in srgb, var(--purple) 9%, transparent);
}

.rp__preset:active {
  transform: scale(0.98);
}

.rp__preset-time {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.rp__toggle {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--purple-deep);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}

.rp__toggle:hover {
  border-color: var(--purple);
  background: color-mix(in srgb, var(--purple) 6%, transparent);
}

.rp__toggle .icon:last-child {
  margin-left: auto;
  transition: transform var(--t-base) var(--ease-out);
}

.rp__toggle[aria-expanded="true"] .icon:last-child {
  transform: rotate(180deg);
}

.rp__custom {
  display: grid;
  gap: var(--s-3);
  padding-top: var(--s-1);
}

.rp__custom[hidden] {
  display: none;
}

.rp__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-1);
}

.rp__month {
  font-weight: 600;
}

.rp__nav {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}

.rp__nav:hover:not(:disabled) {
  background: color-mix(in srgb, var(--purple) 10%, transparent);
}

.rp__nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.rp__weekdays,
.rp__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}

.rp__weekdays span {
  padding: 4px 0;
  color: var(--muted);
  font-size: var(--fs-xs);
}

.rp__days {
  gap: 2px;
}

.rp__days.is-from-right {
  animation: rp-from-right 0.26s var(--ease-out);
}

.rp__days.is-from-left {
  animation: rp-from-left 0.26s var(--ease-out);
}

@keyframes rp-from-right {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
}

@keyframes rp-from-left {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
}

.rp__day {
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.rp__day:hover:not(:disabled) {
  background: color-mix(in srgb, var(--purple) 12%, transparent);
}

.rp__day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--purple);
}

.rp__day.is-selected {
  background: var(--purple);
  color: var(--white);
  transform: scale(1.06);
}

.rp__day:disabled {
  opacity: 0.3;
  cursor: default;
}

.rp__day:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 1px;
}

.rp__times {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.rp__time {
  display: grid;
  gap: 1px;
  padding: 6px 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.rp__time small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 400;
}

.rp__time:hover {
  border-color: var(--purple);
}

.rp__time.is-on {
  border-color: var(--purple);
  background: color-mix(in srgb, var(--purple) 12%, transparent);
  color: var(--purple-deep);
}

.rp__clock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.rp__stepper,
.rp__ampm {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
}

.rp__step {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}

.rp__step .icon {
  width: 14px;
  height: 14px;
}

.rp__step:hover {
  background: color-mix(in srgb, var(--purple) 12%, transparent);
}

.rp__num {
  min-width: 2ch;
  font-size: var(--fs-md);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.rp__colon {
  font-weight: 700;
}

.rp__ampm button {
  padding: 4px 10px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.rp__ampm button.is-on {
  background: var(--purple);
  color: var(--white);
}

.rp__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding-top: var(--s-2);
  border-top: 1px solid var(--border);
}

.rp__summary {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: color var(--t-fast) var(--ease-out);
}

.rp__summary.is-past {
  color: var(--danger);
  font-weight: 500;
}

/* ---------- Public /notes page (site layout) ---------- */
.notes-page__hero {
  padding-bottom: var(--s-4);
}

.notes-page__app {
  padding-bottom: var(--s-6);
}

.notes-embed {
  min-height: 420px;
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--canvas);
  box-shadow: var(--shadow-2);
}

.notes-page__features {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
}

.notes-page__feature p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  .notes-embed {
    padding: var(--s-2);
    border-radius: var(--r-lg);
  }
}

@media (max-width: 640px) {
  /* While a note sheet is open the dock would cover its toolbar. */
  body:has(.note-win:not([hidden]):not([data-state="min"])) .note-dock {
    display: none;
  }

  .note-win .note-editor__edited {
    display: none;
  }
}
