/* Shared components and layout.
   Use this file for reusable shells, cards, navigation, note lists and responsive component rules. */
/* Navbar */
.navbar-brand {
  font-weight: 700;
  color: var(--primary) !important;
  letter-spacing: -0.5px;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0;
  margin-left: 0.85rem;
}

.navbar-brand-logo {
  display: block;
}

.navbar-brand-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
}

.navbar-brand-title {
  line-height: 1;
}

.navbar-brand-version {
  font-size: 0.66rem;
  line-height: 1;
  letter-spacing: 0.04em;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.78;
}

.navbar {
  background: var(--glass);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: var(--nav-height);
  padding-top: .1rem;
  padding-bottom: .1rem;
  transition: transform 180ms ease, margin-bottom 180ms ease;
}

body.header-hidden .navbar {
  transform: translateY(calc(-1 * var(--nav-height)));
  margin-bottom: calc(-1 * var(--nav-height));
  pointer-events: none;
}

.navbar .container-fluid {
  min-height: calc(var(--nav-height) - 6px);
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.navbar-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.navbar .btn {
  padding-top: .15rem;
  padding-bottom: .15rem;
}

.navbar-brand {
  font-size: 1.35rem;
}

.navbar-brand-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}

/* Header notes search */
.navbar-search-form {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 0.75rem;
  z-index: 10;
}

.navbar-search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.navbar-search-box .ns-clearable-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 100%;
}

.navbar-search-input {
  width: 230px;
  height: 32px;
  padding: 0.2rem 2.2rem 0.2rem 2.25rem;
  font-size: 0.84rem;
  font-weight: 400;
  border-radius: 9999px !important;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.2s ease,
              border-color 0.2s ease,
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar-search-input:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: #9cc5be;
}

.navbar-search-input:focus {
  width: 330px;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16), 0 4px 14px rgba(15, 118, 110, 0.1);
  outline: none;
}

.navbar-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--muted);
  pointer-events: none;
  z-index: 6;
  transition: color 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar-search-box:focus-within .navbar-search-icon {
  color: var(--primary);
  transform: translateY(-50%) scale(1.15);
}

.navbar-search-box .ns-clear-button {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.45rem;
  height: 1.45rem;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 7;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar-search-box .ns-has-clear-value > .ns-clear-button {
  display: inline-flex;
  animation: nsSearchPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar-search-box .ns-clear-button:hover,
.navbar-search-box .ns-clear-button:focus {
  background: rgba(15, 118, 110, 0.12);
  color: var(--primary);
  transform: translateY(-50%) rotate(90deg) scale(1.1);
}

@keyframes nsSearchPopIn {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(0.6);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

.navbar-search-kbd {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  opacity: 0.65;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.navbar-search-kbd kbd {
  font-size: 0.62rem;
  padding: 1px 4px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 4px;
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

.navbar-search-box:focus-within .navbar-search-kbd,
.navbar-search-box.has-value .navbar-search-kbd {
  opacity: 0;
  transform: translateY(-50%) scale(0.75);
  pointer-events: none;
}

/* Responsive navbar search */
@media (max-width: 991.98px) {
  .navbar-search-input {
    width: 170px;
  }
  .navbar-search-input:focus {
    width: 220px;
  }
}

@media (max-width: 767.98px) {
  .navbar-brand-group {
    flex-wrap: wrap;
    width: 100%;
    gap: 0.35rem;
  }
  .navbar-search-form {
    order: 3;
    width: 100%;
    margin-left: 0;
    margin-top: 0.25rem;
  }
  .navbar-search-box,
  .navbar-search-box .ns-clearable-wrap,
  .navbar-search-input {
    width: 100% !important;
  }
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  border: none;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.18);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.text-primary {
  color: var(--primary) !important;
}

.bg-primary {
  background-color: var(--primary) !important;
}

.border-primary {
  border-color: var(--primary) !important;
}

.btn-outline-primary {
  color: var(--primary);
  border-color: rgba(15, 118, 110, 0.35);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.page-link {
  color: var(--primary);
}

.page-item.active .page-link {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Clear buttons for text inputs */
.ns-clearable-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.ns-clearable-wrap > .form-control {
  padding-right: 2.35rem;
}

.ns-clear-button {
  display: none;
  align-items: center;
  justify-content: center;
}

.ns-clearable-wrap > .ns-clear-button {
  position: absolute;
  top: 50%;
  right: 0.42rem;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  line-height: 1;
  z-index: 4;
}

.ns-clearable-wrap-textarea > .ns-clear-button {
  top: 0.5rem;
  transform: none;
}

.ns-clearable-wrap.ns-has-clear-value > .ns-clear-button,
.input-group.ns-has-clear-value > .ns-clear-button {
  display: inline-flex;
}

.ns-clearable-wrap > .ns-clear-button:hover,
.ns-clearable-wrap > .ns-clear-button:focus {
  background: rgba(15, 23, 42, 0.08);
  color: var(--primary);
}

.input-group > .ns-clear-button {
  border-color: var(--border);
}

/* Cards and editor */
.editor-container,
.login-card,
.note-item {
  border-radius: 6px;
}

.editor-container {
  background: var(--card-bg);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--border);
}

.login-card {
  padding: 36px;
  max-width: 520px;
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  border-right: none;
  box-shadow: 8px 0 22px rgba(15, 23, 42, 0.05);
  padding: 10px !important;
  overflow-x: hidden;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.notes-index-shell {
  display: flex;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  margin-left: 0;
  margin-right: 0;
}

.notes-mobile-switcher {
  display: none;
  margin-bottom: 8px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  gap: 3px;
}

.notes-mobile-switcher-btn {
  flex: 1 1 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #52716d;
  padding: 0.45rem 0.62rem;
  font-size: 0.84rem;
  font-weight: 700;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.notes-mobile-switcher-btn.is-active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.18);
}

.notes-nav-column {
  flex: 0 0 var(--notes-nav-w, 180px);
  width: var(--notes-nav-w, 180px);
  overflow-x: hidden;
  height: 100%;
  min-height: 0;
  padding-left: 0;
  padding-right: 0;
}

.notes-index-shell .notes-list-column {
  flex: 0 0 var(--notes-list-w, 260px);
  width: var(--notes-list-w, 260px);
  min-width: 120px;
  overflow: hidden;
  height: 100%;
  min-height: 0;
  padding-left: 0;
  padding-right: 0;
}

.notes-list-panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px;
  background: var(--card-bg);
}

.notes-index-shell .notes-editor-column {
  flex: 1 1 auto;
  min-width: 200px;
  display: flex;
  min-height: 100%;
  padding-bottom: 0;
  padding-left: 6px;
  padding-right: 0;
}

.notes-panel-resize-handle {
  flex: 0 0 5px;
  width: 5px;
  cursor: col-resize;
  background: var(--border);
  opacity: 0.5;
  transition: opacity 160ms ease, background 160ms ease;
  z-index: 5;
  border-radius: 2px;
}

.notes-panel-resize-handle:hover,
.notes-panel-resize-handle.is-dragging {
  opacity: 1;
  background: var(--primary);
}

.notes-nav-column .btn {
  font-size: .78rem;
  padding: .28rem .45rem;
}

.notes-nav-column .input-group .form-control,
.notes-nav-column .input-group .btn {
  font-size: .76rem;
  padding-top: .22rem;
  padding-bottom: .22rem;
}

.notes-nav-column h6 {
  font-size: .67rem;
  letter-spacing: .02em;
}

.notes-list-panel h6 {
  font-size: .67rem;
  letter-spacing: .02em;
}

.notes-selection-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.06) 0%, rgba(15, 118, 110, 0.12) 100%);
}

.notes-selection-toolbar .form-select {
  width: auto;
  min-width: 150px;
}

.notes-selection-count {
  font-size: .76rem;
  font-weight: 700;
  color: var(--text);
}

.notebook-tree-label {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 2px 4px;
  margin-bottom: 1px;
}

.notebook-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.notebook-tree-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 5px;
  text-decoration: none;
  color: var(--text);
  font-size: .76rem;
  overflow: hidden;
  transition: background 140ms ease, color 140ms ease;
}

.notebook-tree-item:hover {
  background: var(--surface-soft);
  color: var(--text);
  text-decoration: none;
}

.notebook-tree-item.is-selected {
  background: rgba(15, 118, 110, 0.12);
  color: var(--primary);
  font-weight: 600;
}

.notebook-tree-icon {
  flex: 0 0 auto;
  font-size: .72rem;
  color: var(--muted);
}

.notebook-tree-item.is-selected .notebook-tree-icon {
  color: var(--primary);
}

.notebook-color-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.notebook-tree-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notebook-tree-count {
  flex: 0 0 auto;
  font-size: .62rem;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 0 4px;
  min-width: 16px;
  text-align: center;
}

.note-list {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  box-sizing: border-box;
  padding-right: 6px;
}

.note-list.note-list-compact {
  display: block;
}

.note-list.note-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-content: start;
}

.note-item {
  padding: 9px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--card-bg);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.note-list.note-list-grid .note-item {
  margin-bottom: 0;
  height: 130px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch !important;
  justify-content: flex-start !important;
}

.note-list.note-list-grid .note-item > div:nth-child(2) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.note-item:hover {
  background: #edf8f5;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.11);
}

.note-item {
  transition: transform 180ms ease, background 180ms ease;
}

.note-item-pinned {
  background: var(--note-pinned-bg);
  border-color: var(--note-pinned-border);
  box-shadow: 0 2px 8px rgba(168, 136, 41, 0.14);
}

.note-item-pinned:hover {
  background: var(--note-pinned-bg-hover);
}

.note-item-favorite {
  background: var(--note-favorite-bg);
  border-color: var(--note-favorite-border);
  box-shadow: 0 2px 6px rgba(154, 111, 45, 0.08);
}

.note-item-favorite:hover {
  background: var(--note-favorite-bg-hover);
}

.note-item-pinned.note-item-favorite {
  background: var(--note-pinned-bg);
  border-color: var(--note-pinned-border);
  box-shadow: 0 2px 8px rgba(168, 136, 41, 0.14);
}

.note-item-pinned.note-item-favorite:hover {
  background: var(--note-pinned-bg-hover);
}

.note-pin-badge,
.note-favorite-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  background: rgba(180, 124, 22, 0.12);
  color: #9a6700;
  font-size: 0.68rem;
  flex: 0 0 auto;
}

.note-pin-badge {
  background: var(--note-pinned-badge-bg);
  color: var(--note-pinned-badge-color);
}

.note-favorite-badge {
  background: var(--note-favorite-badge-bg);
  color: var(--note-favorite-badge-color);
}

.note-entry {
  opacity: 1;
  transform: translateY(0);
  position: relative;
}

.note-entry.note-enter {
  animation: noteCardEnter 220ms ease forwards;
}

.note-entry.note-leave {
  animation: noteCardLeave 170ms ease forwards;
  pointer-events: none;
}

@keyframes noteCardEnter {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.992);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes noteCardLeave {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
}

.note-entry.is-active {
  background: #ddf4ef;
  box-shadow: inset 0 0 0 1px #84c5b8;
}

.note-selection-marker {
  display: none;
  position: absolute;
  top: 9px;
  right: 9px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #a8cfc6;
  background: #fff;
  color: transparent;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.selection-mode .note-entry {
  padding-right: 38px;
  cursor: pointer;
}

.selection-mode .note-entry .note-selection-marker {
  display: inline-flex;
}

.selection-mode .note-entry.is-selected {
  background: #e3f7f0;
  box-shadow: inset 0 0 0 1px #4e9e84;
}

.selection-mode .note-entry.is-selected .note-selection-marker {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.selection-mode .note-trash-actions {
  opacity: 0.45;
  pointer-events: none;
}

.note-entry-trash {
  border: 1px solid #efb4b4;
  background: linear-gradient(180deg, #fff8f8 0%, #ffeaea 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.note-entry-trash:hover {
  background: linear-gradient(180deg, #fff2f2 0%, #ffe6e6 100%);
  transform: translateY(-1px);
}

.note-entry-trash-clickable {
  cursor: pointer;
}

.note-entry-trash-clickable.is-active {
  box-shadow: inset 0 0 0 1px #dd8f8f;
}

.note-trash-actions {
  min-width: 96px;
}

.note-trash-actions .btn {
  font-size: .62rem;
  padding: .14rem .26rem;
  line-height: 1.1;
}

.note-title {
  font-weight: 650;
  font-size: .78rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.note-preview {
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.2;
  margin-top: 2px !important;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.note-list.note-list-grid .note-preview {
  -webkit-line-clamp: 2;
  margin-bottom: 8px;
}

.note-dates {
  margin-top: 6px !important;
}

.note-list.note-list-grid .note-dates {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 6px;
  margin-top: auto !important;
  flex-shrink: 0;
}

.note-list.note-list-grid .note-date-item {
  font-size: .62rem;
  line-height: 1.3;
}

.note-list.note-list-grid .text-end {
  display: none;
}

.note-date-item {
  font-size: .68rem;
  line-height: 1.4;
  color: #6c757d;
}

.note-date-updated {
  color: var(--primary);
  font-size: .68rem;
}

.note-meta-compact {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  color: #64748b;
}

.note-meta-compact small {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.note-meta-separator {
  opacity: 0.4;
}

.note-item .badge {
  font-size: .58rem;
  padding: .22rem .35rem;
}

.note-view-toggle .btn {
  padding: .05rem .38rem;
  line-height: 1.1;
}

/* Quill editor tweaks */
.ql-toolbar.ql-snow {
  border-radius: 10px 10px 0 0;
}

#editor,
.ql-container.ql-snow {
  border-radius: 0 0 10px 10px;
  min-height: 320px;
}

/* Imágenes dentro del contenido Quill — siempre se adaptan al ancho disponible */
.ql-editor img {
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain;
}

.note-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #cfe0dc;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f0fdfa 100%);
  color: #0b5e57;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

.note-pdf-link::before {
  content: 'PDF';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #d93025;
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.04em;
}

ul.task-list {
  list-style: none !important;
  padding-left: 0;
  padding-inline-start: 0;
  margin: 10px 0;
}

ul.task-list > li.task-item,
li.task-item {
  position: relative;
  display: block;
  list-style: none;
  margin-bottom: 8px;
  padding-left: 1.9rem;
}

ul.task-list > li.task-item::marker,
li.task-item::marker {
  content: '';
}

ul.task-list > li.task-item:has(> .task-checkbox),
li.task-item:has(> .task-checkbox) {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding-left: 0;
}

ul.task-list > li.task-item:has(> .task-checkbox)::before,
ul.task-list > li.task-item:has(> .task-checkbox)::after,
li.task-item:has(> .task-checkbox)::before,
li.task-item:has(> .task-checkbox)::after {
  content: none;
}

ul.task-list > li.task-item::before,
li.task-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.24rem;
  width: 1.1rem;
  height: 1.1rem;
  border: 1px solid #94a3b8;
  border-radius: 0.35rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

ul.task-list > li.task-item::after,
li.task-item::after {
  content: '';
  position: absolute;
  left: 0.34rem;
  top: 0.38rem;
  width: 0.26rem;
  height: 0.5rem;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) scale(0);
  transform-origin: center;
}

ul.task-list > li.task-item.task-done::before,
li.task-item.task-done::before {
  background: #0f766e;
  border-color: #0f766e;
}

ul.task-list > li.task-item.task-done::after,
li.task-item.task-done::after {
  transform: rotate(45deg) scale(1);
}

ul.task-list > li.task-item.task-done,
li.task-item.task-done {
  color: #64748b;
  text-decoration: line-through;
  font-style: italic;
}

div.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

div.task-item .task-checkbox {
  display: inline-flex;
  position: relative;
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.22rem;
  border: 1px solid #94a3b8;
  border-radius: 0.35rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

ul.task-list > li.task-item > .task-checkbox,
li.task-item > .task-checkbox {
  display: inline-flex;
  position: relative;
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.22rem;
  border: 1px solid #94a3b8;
  border-radius: 0.35rem;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

div.task-item .task-checkbox::after {
  content: '';
  position: absolute;
  left: 0.34rem;
  top: 0.14rem;
  width: 0.26rem;
  height: 0.5rem;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) scale(0);
  transform-origin: center;
}

ul.task-list > li.task-item > .task-checkbox::after,
li.task-item > .task-checkbox::after {
  content: '';
  position: absolute;
  left: 0.34rem;
  top: 0.14rem;
  width: 0.26rem;
  height: 0.5rem;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) scale(0);
  transform-origin: center;
}

div.task-item.task-done .task-checkbox {
  background: #0f766e;
  border-color: #0f766e;
}

ul.task-list > li.task-item.task-done > .task-checkbox,
li.task-item.task-done > .task-checkbox {
  background: #0f766e;
  border-color: #0f766e;
}

div.task-item.task-done .task-checkbox::after {
  transform: rotate(45deg) scale(1);
}

ul.task-list > li.task-item.task-done > .task-checkbox::after,
li.task-item.task-done > .task-checkbox::after {
  transform: rotate(45deg) scale(1);
}

div.task-item .task-text {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

ul.task-list > li.task-item > .task-text,
li.task-item > .task-text {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

div.task-item.task-done .task-text {
  color: #64748b;
  text-decoration: line-through;
  font-style: italic;
}

ul.task-list > li.task-item.task-done > .task-text,
li.task-item.task-done > .task-text {
  color: #64748b;
  text-decoration: line-through;
  font-style: italic;
}

.notes-top-actions {
  position: sticky;
  top: 0;
  /* Reset for internal scroll */
  z-index: 900;
  padding: 10px 12px 2px;
  margin: 0;
  background: #edf6f3;
  border-bottom: 1px solid #cfe0dc;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset;
}

body:not(.no-global-scroll) .notes-top-actions {
  top: var(--header-offset, 0);
}

.notes-top-actions .btn {
  padding-top: .15rem;
  padding-bottom: .15rem;
  font-size: .9rem;
}

.notes-top-actions .btn-link {
  color: #64748b;
  font-weight: 500;
}

.notes-top-actions .btn-link:hover {
  color: #334155;
}

.note-editor-top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.note-editor-top-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  flex: 0 0 auto;
  min-width: 0;
}

.note-title-sticky {
  position: sticky;
  top: var(--actions-height, 38px);
  z-index: 890;
  background: #ecf5f2;
  padding: 2px 20px 2px;
  border-bottom: 1px solid #cfe0dc;
}

body:not(.no-global-scroll) .note-title-sticky {
  top: calc(var(--header-offset, 0) + var(--actions-height, 38px));
}

.note-title-sticky .form-control {
  font-size: 1.18rem !important;
  line-height: 1.15;
  padding-top: 0;
  padding-bottom: 0;
  background: transparent;
}

.trash-preview-page {
  border: 1px solid #e2b1b1;
  background: linear-gradient(180deg, #fff9f9 0%, #fff1f1 100%);
}

.trash-preview-header {
  padding: 10px 14px 8px;
  border-bottom: 1px solid #e7c1c1;
  background: rgba(255, 255, 255, 0.65);
}

.trash-preview-title {
  font-size: 1.18rem;
  font-weight: 700;
  color: #7a1f1f;
}

.trash-preview-meta {
  font-size: .78rem;
}

.trash-preview-content {
  min-height: calc(100vh - 160px);
  background: #fffdfd;
}

.note-nav-btns .btn {
  background: white;
  border-color: #d1d9e0;
  color: #444;
}

.note-editor-top-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.5rem;
  flex: 1 1 auto;
  width: auto;
  margin-left: auto;
  min-width: 0;
}

.note-header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  flex: 1 1 auto;
  width: auto;
  flex-wrap: nowrap;
  min-width: 0;
}

.form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: auto;
  padding-left: 0;
  margin-bottom: 0;
}

.form-check-label {
  margin-bottom: 0;
  transition: color 0.18s ease;
}

.form-check-input[type=checkbox] {
  flex: 0 0 auto;
  float: none;
  margin: 0;
  width: 1.08rem;
  height: 1.08rem;
  border: 1px solid #bad0cb;
  border-radius: 0.35rem;
  background-color: #fff;
  background-position: center;
  background-size: 0.72rem 0.72rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.form-check-input[type=checkbox]:hover {
  border-color: #7aaea6;
  box-shadow: 0 0 0 0.18rem rgba(20, 184, 166, 0.1);
}

.form-check-input[type=checkbox]:focus {
  border-color: rgba(15, 118, 110, 0.58);
  box-shadow: 0 0 0 0.22rem rgba(20, 184, 166, 0.16), 0 2px 8px rgba(15, 23, 42, 0.08);
}

.form-check-input[type=checkbox]:checked {
  background-color: #0f766e;
  border-color: #0f766e;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.2);
}

.form-check-input[type=checkbox]:checked:hover {
  background-color: #0b5e57;
  border-color: #0b5e57;
}

.form-check-input[type=checkbox]:disabled {
  opacity: 0.58;
  box-shadow: none;
}

.note-header-toggles .form-check {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  padding: 0.42rem 0.82rem;
  padding-left: 0.9rem !important;
  padding-right: 0.9rem !important;
  min-width: 11.25rem;
  border: 1px solid #d9e4ea;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbfd 100%);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  position: relative;
  overflow: hidden;
}

.note-header-toggles .note-header-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.1rem 0.16rem;
  border-radius: 999px;
  transition: color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}

.note-header-toggles .form-check:hover {
  border-color: #bfd2dc;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.07);
}

.note-header-toggles .form-check:focus-within {
  border-color: rgba(15, 118, 110, 0.34);
  box-shadow: 0 0 0 0.18rem rgba(20, 184, 166, 0.12), 0 10px 20px rgba(15, 23, 42, 0.06);
}

.note-header-toggles .note-header-toggle.is-active {
  transform: translateY(-1px);
}

.note-header-toggles .note-header-toggle-favorite.is-active {
  border-color: #f3c86a;
  background: linear-gradient(180deg, #fff8e7 0%, #ffefbf 100%);
  box-shadow: 0 12px 24px rgba(245, 158, 11, 0.18);
}

.note-header-toggles .note-header-toggle-pinned.is-active {
  border-color: #d2b368;
  background: linear-gradient(180deg, #fff9ed 0%, #f7edd0 100%);
  box-shadow: 0 12px 24px rgba(180, 124, 22, 0.16);
}

.note-header-toggles .note-header-toggle-pinned.is-active .note-header-toggle-label {
  background: rgba(255, 255, 255, 0.42);
}

.note-header-toggles .note-header-toggle-favorite.is-active .note-header-toggle-label {
  background: rgba(255, 255, 255, 0.42);
}

.note-header-toggles .note-header-toggle-archived.is-active {
  border-color: #7fc7be;
  background: linear-gradient(180deg, #ecfbf8 0%, #d5f5ef 100%);
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.16);
}

.note-header-toggles .note-header-toggle-archived.is-active .note-header-toggle-label {
  background: rgba(255, 255, 255, 0.34);
}

.note-header-toggles .form-check-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: #5f7284;
  margin-bottom: 0;
  cursor: pointer;
}

.note-header-toggles .form-check-label i {
  color: #94a3b8;
  flex: 0 0 auto;
  margin-right: 2px;
  transition: color 0.18s ease, transform 0.18s ease;
}

.note-header-toggles .form-check-input:checked+.form-check-label {
  color: #24384c;
  font-weight: 700;
}

.note-header-toggles .form-check-input:checked+.form-check-label[for="IsFavorite"] i {
  color: #f59e0b;
  /* Amber for favorite */
}

.note-header-toggles .form-check-input:checked+.form-check-label[for="IsPinned"] i {
  color: #b7791f;
}

.note-header-toggles .form-check-input:checked+.form-check-label[for="IsPinned"] {
  color: #7c530e;
}

.note-header-toggles .form-check-input:checked+.form-check-label[for="IsFavorite"] {
  color: #8a5a00;
}

.note-header-toggles .form-check-input:checked+.form-check-label[for="IsArchived"] i {
  color: #0f766e;
  /* Primary for archived */
}

.note-header-toggles .form-check-input:checked+.form-check-label[for="IsArchived"] {
  color: #0f5c56;
}

.note-header-toggles .form-check-input:checked+.form-check-label i {
  transform: scale(1.08);
}

.note-header-toggles .form-check-input {
  margin: 0 !important;
  margin-left: 0.02rem !important;
  flex-shrink: 0;
}

.note-header-toggles {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  margin-left: auto;
  min-width: 0;
  width: auto;
}

.note-nav-btns,
.note-editor-top-controls > form {
  flex: 0 0 auto;
}

@media (min-width: 992px) {
  .note-editor-top-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
  }

  .note-editor-top-meta {
    width: auto;
    min-width: 0;
  }

  .note-editor-top-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    justify-self: stretch;
    width: 100%;
    margin-left: 0;
    gap: 0.5rem;
  }

  .note-header-controls {
    width: 100%;
    min-width: 0;
  }

  .note-nav-btns,
  .note-editor-top-controls > form,
  .note-editor-top-controls > button {
    margin: 0 !important;
  }
}

.note-header-notebook {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.78rem;
  border: 1px solid #d7e5eb;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fafc 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  flex: 0 1 auto;
  min-width: 0;
  max-width: 300px;
  white-space: nowrap;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.note-header-notebook:hover {
  border-color: #bfd2dc;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.note-header-notebook:focus-within {
  border-color: rgba(15, 118, 110, 0.36);
  background: #fff;
  box-shadow: 0 0 0 0.2rem rgba(20, 184, 166, 0.12), 0 12px 28px rgba(15, 23, 42, 0.06);
}

.note-header-notebook-label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #5d7082;
  white-space: nowrap;
}

.note-header-notebook-select {
  min-width: 0;
  width: 174px;
  max-width: 174px;
  border: 0;
  background: transparent;
  box-shadow: none !important;
  padding: 0.08rem 1.35rem 0.08rem 0;
  font-size: 0.87rem;
  font-weight: 600;
  line-height: 1.2;
  color: #1b415f;
  background-position: right 0.05rem center;
  background-size: 10px 8px;
  text-overflow: ellipsis;
}

.note-header-notebook-select:focus {
  outline: none;
}

.note-nav-btns .btn:hover {
  background: #e4f1f8;
  color: #12364f;
}



.nav-edge-disabled {
  background: #edf2f6 !important;
  border-color: #cdd6de !important;
  color: #8ba0b3 !important;
  box-shadow: none !important;
}

a[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.65;
}

/* Forms */
.form-control:focus {
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.55);
}


/* Smooth transitions for interactive elements */
* {
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

/* Responsive tweaks */
@media(min-width: 992px) {
  .sidebar {
    min-height: 100%;
    padding-top: 24px;
  }
}

@media(max-width: 991.98px) {
  :root {
    --nav-height: 40px;
    --actions-height: 32px;
    --title-height: 36px;
  }

  .notes-top-actions {
    padding: 2px 6px;
  }

  .note-nav-btns .btn {
    padding: .15rem .4rem;
  }

  .note-header-toggles .form-check-label {
    font-size: .8rem;
  }

  .note-header-notebook {
    max-width: 230px;
  }

  .note-header-notebook-label {
    font-size: .76rem;
  }

  .note-header-notebook-select {
    width: 142px;
    max-width: 142px;
    font-size: .78rem;
  }

  .note-side-panel {
    min-height: 0;
    height: 100%;
  }

  .note-panel-frame {
    min-height: 0;
    height: 100%;
  }

  .note-list.note-list-grid {
    grid-template-columns: 1fr;
  }

  .notes-nav-column {
    flex: 0 0 var(--notes-nav-w, 140px);
    width: var(--notes-nav-w, 140px);
  }

  .notes-index-shell .notes-list-column {
    flex: 0 0 var(--notes-list-w, 200px);
    width: var(--notes-list-w, 200px);
    min-width: 100px;
  }

  .notes-index-shell .notes-editor-column {
    flex: 1 1 auto;
    min-width: 160px;
    padding-left: 0;
  }

  .navbar-brand {
    font-size: 1.15rem;
    margin-left: 0.35rem;
    gap: 0.5rem;
  }
}

@media (max-width: 991.98px) {
  .container-fluid,
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .navbar {
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
    padding-bottom: 0;
  }

  .navbar-shell {
    flex-wrap: wrap;
    row-gap: 0.25rem;
  }

  .navbar-brand {
    margin-left: 0;
    min-width: 0;
    flex: 1 1 auto;
  }

  .navbar-brand-logo {
    height: 28px;
    width: auto;
  }

  .navbar-brand-title {
    font-size: 1rem;
  }

  .navbar-env-badge {
    order: 2;
    margin-left: auto;
  }

  .navbar-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .navbar-actions .btn,
  .navbar-actions .navbar-user-link,
  .navbar-actions form {
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .navbar-user-link {
    order: -1;
    max-width: 100%;
    flex: 1 1 100%;
    text-align: right;
  }

  .notes-index-shell {
    flex-direction: column;
    gap: 10px;
    overflow: visible;
  }

  .notes-mobile-switcher {
    display: flex;
    position: sticky;
    top: 3px;
    z-index: 950;
  }

  .notes-nav-column,
  .notes-index-shell .notes-list-column,
  .notes-index-shell .notes-editor-column {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .notes-nav-column,
  .notes-index-shell .notes-list-column,
  .notes-index-shell .notes-editor-column {
    display: none;
  }

  .notes-nav-column.is-mobile-active,
  .notes-index-shell .notes-list-column.is-mobile-active {
    display: block;
  }

  .notes-index-shell .notes-editor-column.is-mobile-active {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - var(--nav-height) - 96px);
  }

  .notes-panel-resize-handle {
    display: none;
  }

  .sidebar,
  .notes-list-panel,
  .note-side-panel {
    border-radius: 12px;
    overflow: hidden;
  }

  .notes-list-panel {
    min-height: 240px;
  }

  .note-side-panel,
  .note-panel-frame {
    min-height: 48vh;
  }

  .notes-index-shell .notes-editor-column.is-mobile-active .note-side-panel,
  .notes-index-shell .notes-editor-column.is-mobile-active .note-panel-frame {
    min-height: calc(100dvh - var(--nav-height) - 120px);
  }

  #notePanelPlaceholder {
    min-height: 180px;
    padding: 20px 14px;
  }

  .note-item {
    padding: 10px;
  }

  .note-entry-trash {
    flex-wrap: wrap;
  }

  .note-trash-actions {
    min-width: 0;
    width: 100%;
    margin-top: 10px;
  }

  .notes-top-actions {
    padding: 8px 10px 6px;
    align-items: stretch !important;
  }

  .notes-top-actions > * {
    flex: 1 1 100%;
    min-width: 0;
  }

  .note-editor-top-actions {
    flex-wrap: wrap;
  }

  .note-editor-top-meta,
  .note-editor-top-controls {
    flex: 1 1 100%;
    width: 100%;
  }

  .notes-top-actions .note-meta-compact small,
  .notes-top-actions .note-header-toggles,
  .notes-top-actions .note-nav-btns,
  .notes-top-actions .btn-group,
  .notes-top-actions .d-flex {
    flex-wrap: wrap;
  }

  .notes-top-actions .note-header-toggles {
    flex-wrap: nowrap !important;
  }

  .notes-top-actions .note-editor-top-controls {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
  }

  .notes-top-actions .note-header-controls {
    order: 1;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap !important;
    justify-content: space-between;
  }

  .notes-top-actions .note-nav-btns {
    flex-wrap: nowrap !important;
    margin-left: auto;
    margin-right: 0 !important;
  }

  .notes-top-actions .note-header-toggles {
    width: auto;
    margin-left: auto;
  }

  .notes-top-actions .note-nav-btns,
  .notes-top-actions .note-editor-top-controls > form,
  .notes-top-actions .note-editor-top-controls > button {
    order: 2;
    flex: 0 0 auto;
  }

  .note-meta-compact small {
    width: 100%;
    row-gap: 0.25rem;
  }

  .note-header-toggles {
    gap: 0.5rem !important;
  }

  .note-header-notebook {
    width: auto;
    flex: 0 1 auto;
    min-width: 0;
    justify-content: flex-start;
  }

  .note-header-notebook-select {
    min-width: 0;
    width: 142px;
    max-width: 142px;
    flex: 0 0 auto;
  }

  body.embedded-editor-host .note-editor-top-controls,
  body.no-global-scroll .note-editor-top-controls {
    width: 100%;
  }

  body.embedded-editor-host .note-editor-top-controls .note-header-toggles,
  body.no-global-scroll .note-editor-top-controls .note-header-toggles {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem !important;
    width: 100%;
    min-width: 0;
  }

  body.embedded-editor-host .note-editor-top-controls .note-header-notebook,
  body.no-global-scroll .note-editor-top-controls .note-header-notebook {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  body.embedded-editor-host .note-editor-top-controls .note-header-toggles .form-check,
  body.no-global-scroll .note-editor-top-controls .note-header-toggles .form-check {
    width: auto;
    flex: 0 0 auto;
    justify-content: flex-start;
    padding-left: 0;
    padding-right: 0;
    white-space: nowrap;
  }

  .note-title-sticky {
    padding-left: 12px;
    padding-right: 12px;
  }

  .notes-editor-page #editor.ql-editor {
    padding-left: 12px;
    padding-right: 12px;
  }

  .notes-selection-toolbar {
    padding: 8px;
  }

  .notes-selection-toolbar .form-select,
  .notes-selection-toolbar .btn,
  .notes-selection-toolbar .notes-selection-count {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 575.98px) {
  .navbar {
    min-height: 38px;
  }

  .navbar .container-fluid {
    min-height: 34px;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .navbar-shell {
    flex-wrap: nowrap;
    gap: 0.25rem;
    row-gap: 0;
    align-items: center;
  }

  .navbar-brand-title {
    display: none;
  }

  .navbar-brand-copy {
    gap: 0;
  }

  .navbar-brand-version {
    font-size: 0.58rem;
  }

  .navbar-brand {
    font-size: 1rem;
  }

  .navbar-brand-logo {
    height: 24px;
  }

  .navbar-env-badge {
    order: 0;
    margin-left: 0;
    padding: 0.18rem 0.38rem;
    line-height: 1;
    flex: 0 0 auto;
  }

  .navbar-actions {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: nowrap;
  }

  .navbar-actions .btn,
  .navbar-actions form,
  .navbar-actions .navbar-user-link {
    flex: 0 1 auto;
  }

  .text-muted-small {
    font-size: 0.75rem;
  }

  .navbar-actions .btn {
    padding: 0.12rem 0.45rem;
    min-height: 30px;
  }

  .navbar-user-link {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.1rem !important;
    text-align: right;
  }

  .navbar-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding-left: 0.42rem !important;
    padding-right: 0.42rem !important;
  }

  .navbar-logout-icon {
    font-size: 0.78rem;
  }

  .navbar-logout-text {
    display: none;
  }

  .notes-mobile-switcher {
    margin-bottom: 6px;
    padding: 2px;
    border-radius: 10px;
    gap: 2px;
  }

  .notes-mobile-switcher-btn {
    padding: 0.38rem 0.45rem;
    font-size: 0.78rem;
    border-radius: 8px;
  }

  .notes-mobile-switcher-btn.is-active {
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.16);
  }

  .notes-top-actions {
    padding: 8px 8px 6px;
  }

  .note-title-sticky .form-control {
    font-size: 1rem !important;
  }

  .note-nav-btns {
    width: 100%;
  }

  .note-nav-btns .btn {
    flex: 1 1 0;
  }

  .note-header-toggles .form-check {
    width: 100%;
    justify-content: flex-start;
    padding-left: 0.82rem !important;
    padding-right: 0.82rem !important;
  }

  .notes-list-panel {
    min-height: 200px;
  }

  .note-side-panel,
  .note-panel-frame {
    min-height: 42vh;
  }

  body.embedded-editor-host .notes-top-actions,
  body.no-global-scroll .notes-top-actions {
    position: static;
    padding: 4px 6px;
    row-gap: 0.35rem !important;
    box-shadow: none;
  }

  body.embedded-editor-host .notes-top-actions .btn,
  body.no-global-scroll .notes-top-actions .btn {
    font-size: 0.82rem;
    padding-top: 0.18rem;
    padding-bottom: 0.18rem;
  }

  body.embedded-editor-host .note-meta-compact small,
  body.no-global-scroll .note-meta-compact small {
    font-size: 0.72rem;
  }

  body.embedded-editor-host .note-header-toggles,
  body.no-global-scroll .note-header-toggles {
    gap: 0.35rem !important;
  }

  body.embedded-editor-host .note-header-toggles .form-check,
  body.no-global-scroll .note-header-toggles .form-check {
    padding: 0.24rem 0.5rem;
    gap: 0.25rem;
  }

  body.embedded-editor-host .note-header-toggles .form-check-label,
  body.no-global-scroll .note-header-toggles .form-check-label {
    font-size: 0.74rem;
  }

  body.embedded-editor-host .note-header-notebook,
  body.no-global-scroll .note-header-notebook {
    padding: 0.2rem 0.55rem;
  }

  body.embedded-editor-host .note-header-notebook-label,
  body.no-global-scroll .note-header-notebook-label {
    font-size: 0.72rem;
  }

  body.embedded-editor-host .note-header-notebook-select,
  body.no-global-scroll .note-header-notebook-select {
    width: 136px;
    max-width: 136px;
    font-size: 0.76rem;
  }

  body.embedded-editor-host .note-title-sticky,
  body.no-global-scroll .note-title-sticky {
    top: 0;
    padding-left: 8px;
    padding-right: 8px;
  }

  body.embedded-editor-host .note-title-sticky .form-control,
  body.no-global-scroll .note-title-sticky .form-control {
    font-size: 0.95rem !important;
  }

  body.embedded-editor-host .note-editor-top-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem;
  }

  body.embedded-editor-host .note-editor-top-actions > * {
    min-width: 0;
  }

  body.embedded-editor-host .note-editor-top-meta {
    width: 100%;
  }

  body.embedded-editor-host .note-editor-top-controls {
    width: 100%;
    display: flex !important;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
  }

  body.embedded-editor-host .note-editor-top-controls .note-header-toggles {
    display: flex !important;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.25rem !important;
    width: auto;
    min-width: 0;
  }

  body.embedded-editor-host .note-editor-top-controls .note-header-notebook {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  body.embedded-editor-host .note-editor-top-controls .form-check-label {
    white-space: nowrap;
    font-size: 0.72rem;
  }

  body.embedded-editor-host .note-editor-top-controls .note-nav-btns {
    width: auto;
    margin: 0 !important;
  }

  body.embedded-editor-host .note-editor-top-controls .note-nav-btns .btn {
    padding: 0.08rem 0.42rem;
  }

  body.embedded-editor-host .note-editor-top-controls > form,
  body.embedded-editor-host .note-editor-top-controls > button {
    justify-self: end;
    margin: 0 !important;
  }

  body.embedded-editor-host .note-editor-top-controls .note-header-toggles .form-check {
    width: auto;
    flex: 0 0 auto;
  }
}

/* Utility */
.text-muted-small {
  color: #98a0b3;
  font-size: 0.95rem;
}

.navbar-user-link {
  max-width: min(32vw, 280px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Footer spacing */
.container-fluid,
.container {
  padding-left: 18px;
  padding-right: 18px;
}

body.no-global-scroll {
  background: white !important;
  background-image: none !important;
}

body.no-global-scroll .container-fluid {
  padding-left: 0;
  padding-right: 0;
}

body.no-global-scroll .notes-top-actions {
  margin: 0;
  padding-left: 20px;
  padding-right: 20px;
}

body.no-global-scroll .note-title-sticky {
  padding-left: 20px;
  padding-right: 20px;
}

body.no-global-scroll .ql-editor {
  padding-left: 20px;
  padding-right: 20px;
}

@media (max-width: 767.98px) {
  body.no-global-scroll .notes-top-actions {
    padding-left: 12px;
    padding-right: 12px;
  }

  body.no-global-scroll .note-title-sticky {
    padding-left: 12px;
    padding-right: 12px;
  }

  body.no-global-scroll .ql-editor {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .note-editor-top-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
  }

  .note-editor-top-actions > * {
    min-width: 0;
  }

  .note-editor-top-meta {
    flex: 0 0 auto;
    width: auto;
  }

  .note-editor-top-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    width: 100%;
    margin-left: 0;
    gap: 0.5rem;
    flex-wrap: nowrap;
  }

  .note-header-controls {
    order: 0;
    flex: 1 1 auto;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap !important;
  }

  .note-header-toggles {
    width: auto;
    margin-left: auto;
  }

  .note-nav-btns,
  .note-editor-top-controls > form,
  .note-editor-top-controls > button {
    order: 0;
    flex: 0 0 auto;
    margin: 0 !important;
  }

  .note-header-notebook {
    width: auto;
    flex: 0 1 auto;
    justify-content: flex-start;
  }

  .note-header-notebook-select {
    width: 142px;
    max-width: 142px;
    flex: 0 0 auto;
  }
}

body.no-global-scroll:not(.embedded-editor-host) .notes-top-actions.note-editor-top-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  row-gap: 0.5rem;
}

body.no-global-scroll:not(.embedded-editor-host) .notes-top-actions.note-editor-top-actions > * {
  min-width: 0;
}

body.no-global-scroll:not(.embedded-editor-host) .note-editor-top-meta {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  gap: 0.75rem;
}

body.no-global-scroll:not(.embedded-editor-host) .note-editor-top-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  margin-left: 0;
}

body.no-global-scroll:not(.embedded-editor-host) .note-header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.5rem;
  flex-wrap: nowrap;
  grid-column: 1;
}

body.no-global-scroll:not(.embedded-editor-host) .note-header-notebook {
  width: auto;
  flex: 0 1 auto;
  justify-content: flex-start;
}

body.no-global-scroll:not(.embedded-editor-host) .note-header-notebook-select {
  flex: 0 0 auto;
}

body.no-global-scroll:not(.embedded-editor-host) .note-header-toggles {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  width: auto;
  margin-left: auto;
}

body.no-global-scroll:not(.embedded-editor-host) .note-editor-side-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex: 0 0 auto;
  min-width: 0;
  grid-column: 2;
}

body.no-global-scroll:not(.embedded-editor-host) .note-editor-side-actions .note-nav-btns,
body.no-global-scroll:not(.embedded-editor-host) .note-editor-side-actions > form,
body.no-global-scroll:not(.embedded-editor-host) .note-editor-side-actions > button {
  margin: 0 !important;
  flex: 0 0 auto;
}

/* Final layout for normal web edit view: exactly two rows */
body.no-global-scroll .note-editor-top-actions,
body.embedded-editor-host .note-editor-top-actions {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  row-gap: 0.5rem;
  column-gap: 0;
}

body.no-global-scroll .note-editor-top-bar,
body.embedded-editor-host .note-editor-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap !important;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

body.no-global-scroll .note-editor-top-meta,
body.embedded-editor-host .note-editor-top-meta {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
}

body.no-global-scroll .note-editor-top-controls,
body.embedded-editor-host .note-editor-top-controls {
  display: block !important;
  width: 100%;
  margin-left: 0;
}

body.no-global-scroll .note-header-controls,
body.embedded-editor-host .note-header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  flex-wrap: nowrap !important;
  width: 100%;
  min-width: 0;
}

body.no-global-scroll .note-header-toggles,
body.embedded-editor-host .note-header-toggles {
  margin-left: 0;
  flex-wrap: nowrap !important;
}

body.no-global-scroll .note-editor-side-actions,
body.embedded-editor-host .note-editor-side-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex: 0 0 auto;
  min-width: 0;
}

body.no-global-scroll .note-editor-side-actions .note-nav-btns,
body.no-global-scroll .note-editor-side-actions > form,
body.no-global-scroll .note-editor-side-actions > button,
body.embedded-editor-host .note-editor-side-actions .note-nav-btns,
body.embedded-editor-host .note-editor-side-actions > form,
body.embedded-editor-host .note-editor-side-actions > button {
  flex: 0 0 auto;
  margin: 0 !important;
}

@media (max-width: 575.98px) {
  .notes-top-actions.note-editor-top-actions > .note-editor-top-controls {
    width: 100%;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.4rem;
  }

  .notes-top-actions.note-editor-top-actions > .note-editor-top-controls .note-header-toggles {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 0.4rem !important;
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
  }

  .notes-top-actions.note-editor-top-actions > .note-editor-top-controls .note-header-notebook,
  .notes-top-actions.note-editor-top-actions > .note-editor-top-controls .note-header-notebook-select,
  .notes-top-actions.note-editor-top-actions > .note-editor-top-controls .form-check {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .notes-top-actions.note-editor-top-actions > .note-editor-top-controls .form-check-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.no-global-scroll .note-editor-top-bar,
  body.embedded-editor-host .note-editor-top-bar {
    flex-wrap: wrap !important;
    align-items: stretch;
    gap: 0.4rem;
  }

  body.no-global-scroll .note-editor-top-meta,
  body.embedded-editor-host .note-editor-top-meta {
    width: 100%;
    flex: 1 1 100%;
  }

  body.no-global-scroll .note-editor-side-actions,
  body.embedded-editor-host .note-editor-side-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: stretch;
    gap: 0.4rem;
  }

  body.no-global-scroll .note-editor-side-actions .note-nav-btns,
  body.embedded-editor-host .note-editor-side-actions .note-nav-btns {
    grid-column: 1 / -1;
    width: 100%;
    margin: 0 !important;
  }

  body.no-global-scroll .note-editor-side-actions > form,
  body.no-global-scroll .note-editor-side-actions > button,
  body.embedded-editor-host .note-editor-side-actions > form,
  body.embedded-editor-host .note-editor-side-actions > button {
    justify-self: end;
  }

  body.no-global-scroll .note-header-controls,
  body.embedded-editor-host .note-header-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 0.4rem;
  }

  body.no-global-scroll .note-header-notebook,
  body.embedded-editor-host .note-header-notebook {
    width: 100%;
    max-width: none;
  }

  body.no-global-scroll .note-header-notebook-select,
  body.embedded-editor-host .note-header-notebook-select {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  body.no-global-scroll .note-header-toggles,
  body.embedded-editor-host .note-header-toggles {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 0.4rem !important;
    width: 100%;
    min-width: 0;
  }

  body.no-global-scroll .note-header-toggles .form-check,
  body.embedded-editor-host .note-header-toggles .form-check {
    width: 100%;
    min-width: 0;
    padding: 0.38rem 0.72rem;
    padding-left: 0.72rem !important;
    padding-right: 0.72rem !important;
  }

  body.no-global-scroll .note-header-toggles .note-header-toggle-label,
  body.embedded-editor-host .note-header-toggles .note-header-toggle-label {
    padding: 0.08rem 0.14rem;
  }

  body.no-global-scroll .note-header-toggles .form-check-label,
  body.embedded-editor-host .note-header-toggles .form-check-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Force plain white editing canvas even when dark mode is enabled. */

/* Auth pages */
.app-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(248, 250, 252, 0.78);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    box-sizing: border-box;
    -webkit-backdrop-filter: blur(6px);
}

.app-loading-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.app-loading-card {
    width: min(26rem, 100%);
    display: flex;
    align-items: center;
    gap: 0.95rem;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 1.25rem 3rem rgba(15, 23, 42, 0.16);
}

.app-loading-spinner {
    width: 2.1rem;
    height: 2.1rem;
    flex: 0 0 auto;
    display: inline-block;
    border: 0.24rem solid rgba(15, 118, 110, 0.16);
    border-top-color: var(--primary);
    border-right-color: var(--primary);
    border-radius: 50%;
    animation: app-loading-spin 0.8s linear infinite;
    box-sizing: border-box;
}

.app-loading-copy {
    min-width: 0;
}

.app-loading-title {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.app-loading-subtitle {
    margin-top: 0.2rem;
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.35;
}

body.app-loading-active {
    cursor: progress;
}

@keyframes app-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Vault Aesthetics & Components ─────────────────────────────────────── */
.vault-search-wrapper {
  position: relative;
}

.vault-search-box {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 9999px;
  background: var(--card-bg, #ffffff);
  border: 1.5px solid var(--border, #cfe0dc);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  transition: border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.2s ease;
}

.vault-search-box:focus-within {
  border-color: var(--primary, #0f766e);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16), 0 8px 22px rgba(15, 118, 110, 0.1);
  background: #ffffff;
}

.vault-search-icon {
  position: absolute;
  left: 1.15rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  color: var(--muted, #64748b);
  pointer-events: none;
  z-index: 4;
  transition: color 0.2s ease, transform 0.2s ease;
}

.vault-search-box:focus-within .vault-search-icon {
  color: var(--primary, #0f766e);
  transform: translateY(-50%) scale(1.15);
}

.vault-search-input {
  width: 100%;
  height: 42px;
  border: none !important;
  background: transparent !important;
  padding: 0.45rem 2.8rem 0.45rem 2.9rem !important;
  font-size: 0.9rem;
  border-radius: 9999px !important;
  color: var(--text);
  box-shadow: none !important;
}

.vault-search-input:focus {
  outline: none;
  box-shadow: none !important;
}

.vault-search-clear {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted, #64748b);
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.vault-search-clear:hover {
  background: rgba(15, 118, 110, 0.12);
  color: var(--primary, #0f766e);
  transform: translateY(-50%) rotate(90deg) scale(1.1);
}

.vault-search-badge {
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  background: var(--surface, #f2f7f6) !important;
  color: var(--muted, #64748b) !important;
}

/* Ocultar aspa nativa de los navegadores WebKit/Blink en campos search */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: none !important;
}

/* Cliente cards in Vault/Index - Diseño compacto (4 por fila) */
.cliente-card {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.cliente-card .card {
  border-radius: 10px;
  border: 1px solid var(--border, #cfe0dc);
  background: var(--card-bg, #ffffff);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.22s ease;
}

.cliente-card .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.12);
  border-color: #9cc5be;
}

.cliente-card .card-body {
  padding: 0.85rem 0.95rem;
}

.cliente-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12) 0%, rgba(20, 184, 166, 0.08) 100%);
  color: var(--primary, #0f766e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.cliente-card .card-title {
  font-size: 0.92rem;
}

.cliente-card .card-text {
  font-size: 0.78rem !important;
  line-height: 1.35;
  margin-bottom: 0.5rem !important;
}

/* Entrada cards (vista libre) in Vault/Cliente - Diseño compacto (4 por fila) */
.entrada-card {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.entrada-card .card {
  border-radius: 10px;
  border: 1px solid var(--border, #cfe0dc);
  background: var(--card-bg, #ffffff);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.entrada-card .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.08);
  border-color: #9cc5be;
}

.entrada-card .card-body {
  padding: 0.75rem 0.85rem;
}

.entrada-card .card-title {
  font-size: 0.88rem;
  font-weight: 600;
}

.entrada-card .btn-sm {
  padding: 0.15rem 0.35rem;
  font-size: 0.72rem;
}

.entrada-card .campos-table {
  font-size: 0.76rem;
  margin-bottom: 0.4rem !important;
}

.entrada-card .campos-table th,
.entrada-card .campos-table td {
  padding: 0.2rem 0.3rem;
}

.entrada-card .entrada-etiquetas .badge {
  font-size: 0.65rem;
  padding: 0.18rem 0.45rem;
}

/* Global search results box */
.vault-global-results-card {
  border-radius: 14px;
  border: 1px solid var(--border, #cfe0dc);
  background: var(--card-bg, #ffffff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.vault-global-results-header {
  padding: 0.75rem 1.15rem;
  background: var(--surface, #f2f7f6);
  border-bottom: 1px solid var(--border, #cfe0dc);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.vault-result-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: background-color 0.18s ease, transform 0.18s ease;
  padding: 0.75rem 1.15rem;
}

.vault-result-item:last-child {
  border-bottom: none;
}

.vault-result-item:hover {
  background-color: rgba(15, 118, 110, 0.04);
}

/* Floating Go to Top button */
.vault-gototop-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(15, 118, 110, 0.25);
  background: var(--card-bg, #ffffff);
  color: var(--primary, #0f766e);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.88);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.28s,
              background-color 0.2s ease,
              box-shadow 0.2s ease,
              border-color 0.2s ease;
}

.vault-gototop-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.vault-gototop-btn:hover {
  background: var(--primary, #0f766e);
  color: #ffffff;
  border-color: var(--primary, #0f766e);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.28);
}

.vault-gototop-btn:active {
  transform: translateY(-1px) scale(0.98);
}
