/* Notas internas. Paleta de notas con variantes para modo oscuro. */
:root {
  --note-amarillo: #fbefb8; --note-durazno: #f9dcc8; --note-rosa: #f8dbe4; --note-lavanda: #e4def6;
  --note-cielo: #d6e8f6; --note-menta: #d5efe0; --note-gris: #e8ebee;
  --note-ink: #1f2b28; --note-muted: #55625e; --note-chip: rgba(255,255,255,.55); --note-line: rgba(31,43,40,.14);
}
html[data-theme="dark"] {
  --note-amarillo: #3a3420; --note-durazno: #3b2c23; --note-rosa: #3a2730; --note-lavanda: #2d2a3d;
  --note-cielo: #22303d; --note-menta: #20352b; --note-gris: #2a2d31;
  --note-ink: #f2ece8; --note-muted: #bcb1aa; --note-chip: rgba(255,255,255,.08); --note-line: rgba(255,255,255,.12);
}
[data-color="amarillo"] { --note-bg: var(--note-amarillo); }
[data-color="durazno"] { --note-bg: var(--note-durazno); }
[data-color="rosa"] { --note-bg: var(--note-rosa); }
[data-color="lavanda"] { --note-bg: var(--note-lavanda); }
[data-color="cielo"] { --note-bg: var(--note-cielo); }
[data-color="menta"] { --note-bg: var(--note-menta); }
[data-color="gris"] { --note-bg: var(--note-gris); }

.nav-main[data-icon="notes"]::before,
.workspace-ui .sidebar .nav-main[data-icon="notes"]::before {
  content: ""; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h9l4 4v14H6Z'/%3E%3Cpath d='M14 3v5h5M9 13h7M9 17h5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h9l4 4v14H6Z'/%3E%3Cpath d='M14 3v5h5M9 13h7M9 17h5'/%3E%3C/svg%3E") center / contain no-repeat;
}

#notes svg, .note-dialog svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#notes .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.notes-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.notes-nav { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 14px; padding: 10px; border: 1px solid var(--border, #e3e8ee); border-radius: 12px; background: var(--bg-surface, #fff); }
.notes-nav-group { display: flex; flex-direction: column; gap: 2px; }
.notes-nav-group + .notes-nav-group { padding-top: 12px; border-top: 1px solid var(--border, #e3e8ee); }
.notes-nav-label { margin: 0 8px 6px; font-size: 12px; font-weight: 600; color: var(--text-2, #65747c); }
.notes-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text-1, #1c302c); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.notes-nav-item span:not(.notes-nav-icon):not(.notes-nav-hash) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-nav-item small { color: var(--text-2, #65747c); font-size: 12px; font-variant-numeric: tabular-nums; }
.notes-nav-item:hover { background: var(--bg-raised, #f2f5f7); }
.notes-nav-item.active { background: var(--orange-soft, #fdeee7); color: var(--brand-deep, #c44821); font-weight: 600; }
.notes-nav-item:focus-visible, .notes-bloc:focus-visible, .note-card:focus-visible, .note-dialog button:focus-visible { outline: 2px solid var(--brand, #d85a30); outline-offset: 2px; }
.notes-nav-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--bg-raised, #f2f5f7); color: var(--text-2, #55625e); }
.notes-nav-icon.notes-swatch { background: var(--note-bg); color: var(--note-ink); }
.notes-nav-hash { display: grid; place-items: center; width: 28px; color: var(--text-2, #65747c); font-weight: 600; }

.notes-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.notes-head h2 { margin: 0; font-size: 26px; color: var(--text-1, #1c302c); }
.notes-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.notes-search input { width: 240px; max-width: 100%; min-height: 42px; padding: 8px 14px; border: 1px solid var(--border, #e3e8ee); border-radius: 21px; background: var(--bg-surface, #fff); color: var(--text-1, #1c302c); font: inherit; }
.notes-primary { min-height: 42px; padding: 8px 18px; border: 0; border-radius: 10px; background: var(--brand-deep, #c44821); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.notes-status { margin: 6px 0; color: var(--text-2, #65747c); }
.notes-status:empty { display: none; }

.notes-section { margin-top: 22px; }
.notes-section > h3 { margin: 0 0 12px; font-size: 17px; color: var(--text-1, #1c302c); }
.notes-section > h3 small { margin-left: 6px; font-size: 13px; font-weight: 400; color: var(--text-2, #65747c); }
.notes-blocs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.notes-bloc { position: relative; display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 14px 16px; border: 0; border-radius: 4px 14px 14px 14px; background: var(--note-bg); color: var(--note-ink); font: inherit; text-align: left; cursor: pointer; margin-top: 10px; }
.notes-bloc::before { content: ""; position: absolute; left: 0; top: -9px; width: 46%; height: 12px; border-radius: 8px 8px 0 0; background: var(--note-bg); filter: brightness(.94); }
.notes-bloc-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--note-chip); }
.notes-bloc strong { display: block; font-size: 15px; }
.notes-bloc small { color: var(--note-muted); }
.notes-bloc:hover { filter: brightness(.97); }

.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; align-items: start; }
.note-card { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 140px; padding: 16px; border-radius: 14px; background: var(--note-bg); color: var(--note-ink); cursor: pointer; overflow-wrap: anywhere; transition: box-shadow .15s ease, transform .15s ease; }
.note-card:hover { box-shadow: 0 6px 18px rgba(20, 35, 30, .1); transform: translateY(-1px); }
.note-card h3 { margin: 0; padding-right: 22px; font-size: 16px; line-height: 1.3; }
.note-card-pin { position: absolute; top: 14px; right: 14px; color: var(--note-ink); }
.note-card-body { margin: 0; font-size: 14px; line-height: 1.45; color: var(--note-ink); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.note-card-empty { margin: 0; color: var(--note-muted); font-size: 14px; }
.note-card-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.note-card-list label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.note-card-list input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--note-ink); flex: 0 0 auto; }
.note-card-list label.done span { text-decoration: line-through; color: var(--note-muted); }
.note-card-more { color: var(--note-muted); font-size: 13px; padding-left: 24px; }
.note-card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.note-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 7px; background: var(--note-chip); color: var(--note-ink); font-size: 12px; font-weight: 600; }
.note-chip svg { width: 13px; height: 13px; }
.note-chip-today { background: var(--note-ink); color: var(--note-bg); }
.note-chip-late { background: #b42318; color: #fff; }
.note-chip-author { font-weight: 500; }
.notes-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 16px; color: var(--text-2, #65747c); text-align: center; }
.notes-empty svg { width: 32px; height: 32px; }

/* Editor */
.note-dialog { width: min(580px, calc(100vw - 24px)); max-height: 92dvh; padding: 0; border: 0; border-radius: 18px; background: transparent; overflow: visible; }
.note-dialog::backdrop { background: rgba(20, 28, 26, .45); }
.note-dialog form { display: flex; flex-direction: column; max-height: 92dvh; border-radius: 18px; overflow: hidden; background: var(--bg-page, #fff); box-shadow: 0 24px 60px rgba(0, 0, 0, .25); color: var(--note-ink); }
.note-sheet { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px 24px 18px; background: var(--note-bg); overflow-y: auto; }
.note-close { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.note-dialog :is(input, textarea) { font: inherit; color: var(--note-ink); }
.note-dialog input::placeholder, .note-dialog textarea::placeholder { color: var(--note-muted); opacity: .85; }
.note-title { width: calc(100% - 40px); padding: 4px 0 8px; border: 0; border-bottom: 1px solid var(--note-line); background: transparent; font-size: 22px !important; font-weight: 600; }
.note-body { width: 100%; min-height: 110px; padding: 4px 0; border: 0; background: transparent; resize: vertical; font-size: 15px; line-height: 1.5; }
.note-title:focus, .note-body:focus, .note-tag-input:focus, .note-item-text:focus { outline: none; }
.note-items { display: flex; flex-direction: column; gap: 2px; }
.note-item { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.note-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--note-ink); flex: 0 0 auto; }
.note-item-text { flex: 1; min-width: 0; padding: 4px 0; border: 0; border-bottom: 1px solid transparent; background: transparent; font-size: 15px; }
.note-item-text:focus { border-bottom-color: var(--note-line); }
.note-item.done .note-item-text { text-decoration: line-through; color: var(--note-muted); }
.note-item button, .note-tag button { width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--note-muted); font-size: 18px; cursor: pointer; }
.note-item button:hover, .note-tag button:hover { background: var(--note-chip); color: var(--note-ink); }
.note-item-new span { width: 18px; text-align: center; color: var(--note-muted); font-weight: 600; }
.note-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.note-tags:empty { display: none; }
.note-tag { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border-radius: 8px; background: var(--note-chip); font-size: 13px; font-weight: 600; }
.note-tag-input { width: 100%; padding: 4px 0; border: 0; background: transparent; font-size: 13px !important; }
.note-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.note-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 4px 12px; border-radius: 12px; background: var(--note-chip); font-size: 14px; }
.note-pill input { min-width: 0; width: 150px; border: 0; background: transparent; font-weight: 600; }
.note-pill input:focus { outline: none; }
.note-pill:focus-within { box-shadow: 0 0 0 2px var(--note-ink); }
.note-visibility { margin: 4px 0 0; padding: 10px 12px; border: 1px solid var(--note-line); border-radius: 12px; }
.note-visibility legend { padding: 0 4px; font-size: 12px; font-weight: 600; color: var(--note-muted); }
.note-visibility label { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 14px; cursor: pointer; }
.note-visibility input { accent-color: var(--brand-deep, #c44821); width: 16px; height: 16px; }
.note-visibility p { margin: 2px 0; font-size: 14px; }
.note-sellers { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0 12px; margin: 4px 0 0 24px; padding-top: 6px; border-top: 1px dashed var(--note-line); }
.note-readonly { margin: 0; font-size: 13px; color: var(--note-muted); }
.note-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 12px 16px; background: var(--bg-page, #fff); color: var(--text-1, #1c302c); }
.note-colors { display: flex; gap: 6px; margin-right: auto; }
.note-colors[hidden] { display: none; }
.note-color { width: 28px; height: 28px; padding: 0; border: 1px solid rgba(0, 0, 0, .12); border-radius: 50%; background: var(--note-bg); cursor: pointer; }
.note-color[aria-checked="true"] { box-shadow: 0 0 0 2px var(--bg-page, #fff), 0 0 0 4px var(--text-1, #1c302c); }
.note-save-state { margin-left: auto; font-size: 13px; color: var(--text-2, #65747c); max-width: 220px; text-align: right; }
.note-icon { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--text-1, #1c302c); cursor: pointer; }
.note-icon svg { width: 19px; height: 19px; }
.note-icon:hover { background: var(--bg-raised, #f2f5f7); }
.note-icon[aria-pressed="true"] { background: var(--orange-soft, #fdeee7); color: var(--brand-deep, #c44821); }
.note-icon[hidden] { display: none; }
#noteDelete:hover { color: #b42318; }
.note-dialog [hidden] { display: none !important; }

@media (max-width: 900px) {
  .notes-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .notes-nav { position: static; flex-direction: row; overflow-x: auto; padding: 6px; gap: 6px; scrollbar-width: thin; }
  .notes-nav-group { flex-direction: row; gap: 4px; flex: 0 0 auto; }
  .notes-nav-group + .notes-nav-group { padding: 0 0 0 6px; border-top: 0; border-left: 1px solid var(--border, #e3e8ee); }
  .notes-nav-label { display: none; }
  .notes-nav-item { width: auto; white-space: nowrap; }
  .notes-nav-item span:not(.notes-nav-icon):not(.notes-nav-hash) { overflow: visible; }
}
@media (max-width: 600px) {
  .notes-head h2 { font-size: 22px; }
  .notes-head-actions, .notes-search { width: 100%; }
  .notes-search input { width: 100%; }
  .notes-primary { width: 100%; }
  .notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .note-card { min-height: 110px; padding: 12px; }
  .notes-blocs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .note-sheet { padding: 18px 16px 14px; }
  .note-pill input { width: 120px; }
  .note-save-state { order: 5; width: 100%; max-width: none; margin: 0; text-align: left; }
}
@media (max-width: 380px) { .notes-grid { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .note-card { transition: none; } .note-card:hover { transform: none; } }
/* Neutraliza mínimos globales de formularios dentro de notas. */
#notes :is(input[type="checkbox"], input[type="radio"]), .note-dialog :is(input[type="checkbox"], input[type="radio"]) { min-height: 0; height: 16px; width: 16px; padding: 0; margin: 0; box-shadow: none; }
.note-dialog .note-item input[type="checkbox"] { height: 18px; width: 18px; }
#notes .note-card-list label { font-size: 14px; font-weight: 400; color: var(--note-ink); margin: 0; min-height: 0; text-transform: none; letter-spacing: 0; }
.note-dialog label { margin: 0; text-transform: none; letter-spacing: 0; }
.note-dialog :is(input:not([type="checkbox"]):not([type="radio"]), textarea) { box-shadow: none; border-radius: 0; min-height: 0; }
