/* Notes: the section (search, filters, card grid) and the full editor window. */
#notes { --note-none: var(--surface); --note-sun: #fff5cf; --note-mint: #dff3e8; --note-sky: #deebf8; --note-rose: #fbe3e8; --note-lilac: #ede5f8; }
.note-dialog { --note-none: var(--surface); --note-sun: #fff7d9; --note-mint: #e6f6ed; --note-sky: #e5effa; --note-rose: #fcebee; --note-lilac: #f2ecfa; }
.notes-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.notes-search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--muted); }
.notes-search:focus-within { border-color: var(--accent-dark); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-light) 60%, transparent); }
.notes-search svg { width: 18px; flex-shrink: 0; }
.notes-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); outline: none; }
.notes-bar-actions { display: flex; align-items: center; gap: 4px; }
.notes-sort { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border-radius: 11px; color: var(--muted); }
.notes-sort svg { width: 17px; }
.notes-sort select { border: 0; background: transparent; font: inherit; font-weight: 560; color: var(--ink); padding: 4px 0; }
.notes-filters:empty { display: none; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; align-items: start; }
.note-card { position: relative; display: flex; flex-direction: column; min-height: 132px; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-radius: 16px;
  background: var(--note-none); box-shadow: 0 1px 2px #12302c0d; overflow: hidden; transition: box-shadow .15s, transform .15s; }
.note-card:hover { box-shadow: 0 6px 18px #12302c1a; }
.note-card[data-note-color="sun"] { background: var(--note-sun); border-color: #ead793; }
.note-card[data-note-color="mint"] { background: var(--note-mint); border-color: #b5dcc6; }
.note-card[data-note-color="sky"] { background: var(--note-sky); border-color: #b7cfe9; }
.note-card[data-note-color="rose"] { background: var(--note-rose); border-color: #ecbdc7; }
.note-card[data-note-color="lilac"] { background: var(--note-lilac); border-color: #cfc0e8; }
.note-open { flex: 1; display: grid; align-content: start; gap: 6px; width: 100%; padding: 15px 44px 8px 16px; text-align: start; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.note-open:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: -4px; border-radius: 14px; }
.note-card-title { font-size: 16px; font-weight: 680; color: var(--ink); letter-spacing: -.01em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-card-text { font-size: 13.5px; line-height: 1.5; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.note-card-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 4px 14px 12px 16px; font-size: 12px; color: var(--muted); }
.note-card-meta .note-time { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.note-pin, .note-checks { display: inline-flex; align-items: center; gap: 3px; color: var(--accent-dark); font-weight: 600; }
.note-pin svg, .note-checks svg { width: 14px; }
.note-more { position: absolute; top: 5px; inset-inline-end: 4px; inline-size: 40px; block-size: 40px; border-radius: 10px; color: var(--muted); }
.note-tag svg { width: 12px; }
.notes-empty { margin-top: 8px; }

/* The editor window: large on desktop, full screen on phones. */
dialog.note-dialog { width: min(780px, calc(100% - 24px)); height: min(88dvh, 820px); max-height: none; background: var(--surface); }
.note-dialog #dialog-inner { display: flex; flex-direction: column; height: 100%; padding-bottom: 14px; }
.note-dialog .modal-head { margin-bottom: 6px; }
.note-dialog .modal-head h2 { font-size: 15px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.note-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; margin: 0 -6px; padding: 10px 6px 0; border-radius: 16px; transition: background .2s; }
.note-editor[data-note-color="sun"] { background: var(--note-sun); }
.note-editor[data-note-color="mint"] { background: var(--note-mint); }
.note-editor[data-note-color="sky"] { background: var(--note-sky); }
.note-editor[data-note-color="rose"] { background: var(--note-rose); }
.note-editor[data-note-color="lilac"] { background: var(--note-lilac); }
.note-editor:not([data-note-color="none"]) { padding-inline: 14px; margin-inline: 0; }
.note-title-input { width: 100%; border: 0; background: transparent; font: inherit; font-size: 24px; font-weight: 700; letter-spacing: -.03em; color: var(--ink); padding: 2px 0; outline: none; }
.note-title-input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.note-toolbar { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 4px; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-radius: 13px; background: color-mix(in srgb, white 55%, transparent); flex-shrink: 0; }
.note-toolbar::-webkit-scrollbar { display: none; }
.note-tool { display: inline-grid; place-items: center; inline-size: 38px; block-size: 38px; flex-shrink: 0; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font: 600 16px/1 Georgia, "Times New Roman", serif; cursor: pointer; }
.note-tool svg { width: 18px; }
.note-tool:hover { background: #e1ece9; }
.note-tool[aria-pressed="true"] { background: var(--accent-light); color: var(--accent-dark); }
.note-tool:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: -2px; }
.note-tx { font-family: inherit; }
.note-tx sub { font-size: 10px; }
.note-tool-gap { inline-size: 1px; block-size: 22px; margin: 0 4px; background: var(--line); flex-shrink: 0; }
.note-link-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note-link-bar input { flex: 1 1 200px; min-height: 44px; padding: 0 12px; border: 1px solid #647b77; border-radius: 11px; font: inherit; font-size: 16px; background: var(--surface); }
.note-body { flex: 1; min-height: 180px; overflow-y: auto; padding: 4px 2px 18px; font-size: 16px; line-height: 1.65; color: var(--ink); outline: none; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.note-body:empty::before { content: attr(data-placeholder); color: color-mix(in srgb, var(--muted) 70%, transparent); pointer-events: none; }
.note-body > :first-child { margin-top: 0; }
.note-body p, .note-body div { margin: 0 0 .55em; }
.note-body h2 { font-size: 21px; line-height: 1.3; letter-spacing: -.02em; margin: .9em 0 .35em; }
.note-body h3 { font-size: 18px; margin: .8em 0 .3em; }
.note-body ul, .note-body ol { margin: 0 0 .6em; padding-inline-start: 1.5em; }
.note-body li { margin: .15em 0; }
.note-body blockquote { margin: .5em 0 .8em; padding: .2em 0 .2em 14px; border-inline-start: 3px solid var(--accent-mid); color: var(--text); }
.note-body a { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; }
.note-body code { font-family: var(--mono); font-size: .9em; padding: 1px 5px; border-radius: 5px; background: #0f2f2c12; }
.note-body ul.checklist { list-style: none; padding-inline-start: 0; }
.note-body ul.checklist > li { position: relative; padding-inline-start: 32px; min-height: 26px; }
.note-body ul.checklist > li::before { content: ""; position: absolute; inset-inline-start: 2px; top: .22em; width: 20px; height: 20px; border: 2px solid #6b8582; border-radius: 6px; background: var(--surface); box-sizing: border-box; cursor: pointer; }
.note-body ul.checklist > li[data-checked="true"]::before { background: var(--accent-dark); border-color: var(--accent-dark); }
.note-body ul.checklist > li[data-checked="true"]::after { content: ""; position: absolute; inset-inline-start: 9px; top: calc(.22em + 4px); width: 5px; height: 10px; border: solid white; border-width: 0 2.4px 2.4px 0; transform: rotate(45deg); pointer-events: none; }
.note-body ul.checklist > li[data-checked="true"] { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.note-options { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); flex-shrink: 0; }
.note-option { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; font-weight: 560; color: var(--muted); }
.note-option select { min-height: 38px; padding: 0 8px; border: 1px solid #647b77; border-radius: 10px; font: inherit; color: var(--ink); background: var(--surface); }
.note-pin-toggle input { width: 18px; height: 18px; accent-color: var(--accent-dark); }
.note-colors { display: inline-flex; align-items: center; gap: 4px; border: 0; margin: 0; padding: 0; min-width: 0; }
.note-colors legend { float: left; margin-inline-end: 6px; font-size: 13px; font-weight: 560; color: var(--muted); }
.note-color { position: relative; display: inline-grid; place-items: center; inline-size: 34px; block-size: 34px; cursor: pointer; }
.note-color input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.note-color [data-note-swatch] { width: 24px; height: 24px; border-radius: 50%; border: 1px solid #8aa09d; background: var(--note-none); }
.note-color [data-note-swatch="sun"] { background: #f7e08b; border-color: #d4bb59; }
.note-color [data-note-swatch="mint"] { background: #a9dfc0; border-color: #79b997; }
.note-color [data-note-swatch="sky"] { background: #a9c9ee; border-color: #789fcc; }
.note-color [data-note-swatch="rose"] { background: #f3b6c3; border-color: #cf8798; }
.note-color [data-note-swatch="lilac"] { background: #cbb8ec; border-color: #9f87c8; }
.note-color [data-note-swatch="none"] { background: linear-gradient(135deg, var(--surface) 45%, #c5524f 46% 54%, var(--surface) 55%); }
.note-color input:checked + [data-note-swatch] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-dark); }
.note-color input:focus-visible + [data-note-swatch] { outline: 2px solid var(--accent-dark); outline-offset: 3px; }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; flex-shrink: 0; }
.note-status { display: inline-flex; gap: 10px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.note-saved:not(:empty)::before { content: "·"; margin-inline-end: 10px; }
.note-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-inline-start: auto; }
.note-actions .text-btn { min-height: 40px; }
.note-delete { color: #a23b3b; }
@media (max-width: 650px) {
  .notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .note-card { min-height: 118px; border-radius: 14px; }
  .note-open { padding: 13px 40px 6px 13px; }
  .note-card-title { font-size: 15px; }
  .note-card-text { font-size: 13px; -webkit-line-clamp: 6; }
  .note-card-meta { padding: 2px 12px 11px 13px; gap: 6px; }
  .note-card-meta .tag { display: none; }
  .notes-search { flex-basis: 100%; }
  .notes-bar-actions { width: 100%; justify-content: space-between; }
  dialog.note-dialog { width: 100%; height: 100dvh; max-width: 100%; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .note-dialog #dialog-inner { padding: 12px 14px 10px; }
  .note-title-input { font-size: 22px; }
  .note-toolbar { flex-wrap: wrap; overflow: visible; gap: 2px; }
  .note-tool { flex: 0 0 calc((100% - 12px) / 7); inline-size: auto; }
  .note-tool-gap { display: none; }
  .note-options { gap: 4px 12px; }
}
@media (max-width: 360px) { .notes-grid { grid-template-columns: 1fr; } }
@media (forced-colors: active) {
  .note-tool[aria-pressed="true"] { outline: 2px solid Highlight; }
  .note-body ul.checklist > li::before { border-color: CanvasText; }
}
/* Six buttons in the phone bar since Notes joined it: keep the longer labels apart. */
@media (max-width: 430px) { #bottom-nav button { font-size: 10px; letter-spacing: -.01em; padding-inline: 0; min-width: 0; } }
