:root {
  --ui-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --page-bg: #f5f1e8;
  --panel-bg: #fffdf8;
  --text: #2f2d29;
  --muted: #777166;
  --border: #ddd5c8;
  --accent: #7c6a52;
  --accent-dark: #62523e;
  --shadow: 0 8px 24px rgba(58,49,39,.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--ui-font);
  color: var(--text);
  background: var(--page-bg);
}

button,
input,
select,
textarea,
option,
optgroup,
::file-selector-button {
  font: inherit;
}

button {
  cursor: pointer;
}

.rnc-update-notice {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid #c58a28;
  background: #fff3cf;
  color: #5f430e;
  box-shadow: 0 4px 14px rgba(77, 54, 16, .12);
}

.rnc-update-notice div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.rnc-update-notice button {
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid var(--accent-dark);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
}

body.rnc-update-available .topbar {
  position: relative;
  top: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  background: rgba(245,241,232,.95);
  border-bottom: 1px solid rgba(221,213,200,.75);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.portable-auto-save-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-left: 4px;
  padding: 6px 11px;
  border: 1px solid #b66a5f;
  border-radius: 999px;
  background: #fff0ed;
  color: #7b3027;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.15;
  white-space: nowrap;
  cursor: pointer;
}

.portable-auto-save-status[data-state="on"] {
  border-color: #57906b;
  background: #e9f6ed;
  color: #245f3b;
}

.portable-auto-save-status[data-state="protected"] {
  align-items: flex-start;
  flex-direction: column;
  gap: 1px;
  border-color: #cfc5b6;
  background: #fffdf9;
  color: var(--text);
  white-space: normal;
  text-align: left;
}

.protection-status-primary {
  color: #245f3b;
  font-weight: 800;
}

.protection-status-secondary {
  color: #736959;
  font-size: 10px;
  font-weight: 600;
}

.portable-auto-save-status[data-online-state="synced"] .protection-status-secondary {
  color: #245f3b;
}

.portable-auto-save-status[data-online-state="attention"] .protection-status-secondary {
  color: #8a570c;
}

.portable-auto-save-status[data-state="paused"] {
  border-color: #b27b28;
  background: #fff4d9;
  color: #70480b;
}

.portable-auto-save-status[data-state="unavailable"] {
  border-color: #8a7861;
  background: #f4eee4;
  color: #594a39;
}

.quick-save-sync-area {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-start;
}

.quick-save-sync-button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #806a4d;
  border-radius: 10px;
  background: #8a7558;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.quick-save-sync-button.needs-save {
  border-color: #8a570c;
  background: #9b650f;
  box-shadow: 0 0 0 3px rgba(155, 101, 15, .16);
}

.quick-save-sync-button:disabled {
  cursor: wait;
  opacity: .72;
}

#quickSaveSyncStatus:not(:empty) {
  position: absolute;
  z-index: 22000;
  top: calc(100% + 6px);
  left: 0;
  width: min(310px, calc(100vw - 28px));
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 8px 28px 8px 10px;
  border: 1px solid #a7ceb4;
  border-radius: 9px;
  background: #edf8f0;
  color: #245f3b;
  box-shadow: 0 10px 28px rgba(48, 38, 25, .18);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}

#quickSaveSyncStatus:not(:empty)::after {
  position: absolute;
  top: 5px;
  right: 8px;
  color: currentColor;
  content: "×";
  font-size: 15px;
  line-height: 1;
  opacity: .72;
}

#quickSaveSyncStatus.error:not(:empty) {
  border-color: #d0a39c;
  background: #fff0ed;
  color: #7b3027;
}

#workingRncAutoSaveState[data-state="on"] {
  color: #24623c;
  font-weight: 800;
}

#workingRncAutoSaveState[data-state="paused"],
#workingRncAutoSaveState[data-state="off"] {
  color: #84372d;
  font-weight: 800;
}

#workingRncAutoSaveState[data-state="not-used"] {
  color: #655b4d;
  font-weight: 700;
}

.working-rnc-optional-heading {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(120, 110, 98, .18);
  color: #655b4d;
}

.open-notebook-top-button {
  min-height: 36px;
  white-space: nowrap;
}

.creator #mainRncBuild {
  color: #746a5c;
  font-weight: 650;
  white-space: nowrap;
}

@media (min-width: 701px) {
  .top-controls .open-notebook-top-button {
    height: 34px !important;
    min-height: 34px !important;
    padding-right: 10px !important;
    padding-left: 10px !important;
    font-size: 11px !important;
  }
}

@media (max-width: 700px) {
  .mobile-secondary-controls >
    .open-notebook-top-button {
    order: initial !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 36px;
  }
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  font-size: 24px;
  font-weight: 750;
}

.brand h1 {
  margin: 0;
  font-size: clamp(18px,2vw,23px);
}

.creator {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.top-controls {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.search-input {
  width: min(390px,100%);
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  outline: none;
  background: var(--panel-bg);
}

.layout-toggle {
  display: flex;
  gap: 4px;
}

.layout-button,
.view-button {
  border: 0;
  border-radius: 10px;
  padding: 9px 11px;
  background: transparent;
  color: var(--muted);
}

.layout-button.active,
.view-button.active {
  background: #e9e1d4;
  color: var(--text);
  font-weight: 650;
}

.private-view-button.active {
  border-color: #7a5316;
  background: #5f4214;
  color: #fff;
}

.private-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid #c8b794;
  border-bottom: 1px solid #c8b794;
  background: #fff2bf;
  color: #4d3511;
}

.private-status-bar span {
  flex: 1 1 auto;
}

.private-status-bar button {
  min-height: 34px;
  padding: 4px 10px;
}

.private-status-bar.hidden {
  display: none;
}

.view-nav {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px 0;
}

.mobile-notebook-switcher {
  display: none;
}

/* Phase 1 Containers: a compact hierarchy browser above the familiar cards. */
.container-workspace {
  margin: 0 24px 10px;
  padding: 8px 10px;
  border: 1px solid rgba(77, 59, 38, 0.18);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 5px 18px rgba(72, 54, 34, 0.07);
}

.container-workspace-heading,
.container-workspace-actions,
.container-breadcrumbs,
.container-tree-row {
  display: flex;
  align-items: center;
}

.container-workspace-heading {
  justify-content: space-between;
  gap: 8px;
}

.container-workspace-label {
  display: block;
  margin-bottom: 1px;
  color: #6f5a43;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.container-workspace-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.container-workspace-actions button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.container-breadcrumbs {
  flex-wrap: wrap;
  gap: 3px;
  min-height: 20px;
  font-size: 0.86rem;
  line-height: 1.15;
}

.container-breadcrumbs button {
  border: 0;
  padding: 1px 3px;
  color: #60482f;
  background: transparent;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.container-breadcrumbs button:hover,
.container-breadcrumbs button:focus-visible {
  color: #2d65a6;
  text-decoration: underline;
}

.container-breadcrumb-separator {
  color: #a08d79;
}

.container-tree {
  display: grid;
  gap: 1px;
  max-height: 156px;
  min-height: 0;
  margin-top: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.container-tree-group {
  display: grid;
  gap: 1px;
}

.container-tree-group-heading {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px;
  margin: 3px 0 1px;
}

.container-tree-group-toggle {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #78634d;
  font-weight: 800;
  cursor: pointer;
}

.container-tree-group-toggle:hover,
.container-tree-group-toggle:focus-visible {
  background: #ede4d6;
  color: #274e7c;
}

.container-tree-group-title {
  width: 100%;
  margin: 0;
  padding: 3px 4px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #78634d;
  font-size: 0.74rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.container-tree-root-count {
  margin-right: 4px;
}

.container-tree-group-title:hover,
.container-tree-group-title:focus-visible {
  background: #ede4d6;
  color: #274e7c;
}

.container-tree-group-title.container-drop-inside {
  background: #fff0c9;
  color: #68420f;
  box-shadow: inset 0 0 0 2px rgba(154, 103, 26, .3);
}

.container-tree-row {
  gap: 3px;
  min-height: 27px;
  padding-left: calc(var(--container-depth, 0) * 14px);
}

.container-tree-row[draggable="true"],
.manage-container-drag-handle[draggable="true"] {
  cursor: grab;
}

.container-tree-row.container-dragging,
.manage-container-row.container-dragging {
  opacity: 0.48;
  cursor: grabbing;
}

.container-tree-row.container-drop-before,
.manage-container-row.container-drop-before {
  box-shadow: inset 0 3px 0 #8a7457;
}

.container-tree-row.container-drop-after,
.manage-container-row.container-drop-after {
  box-shadow: inset 0 -3px 0 #8a7457;
}

.container-tree-row.container-drop-inside,
.manage-container-row.container-drop-inside,
.manage-container-root-drop.container-drop-inside {
  border-color: #9a671a;
  background: #fff0c9;
  box-shadow: inset 0 0 0 2px rgba(154, 103, 26, .22);
}

.container-tree-toggle,
.container-tree-open {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.container-tree-toggle {
  width: 26px;
  height: 26px;
  min-width: 26px;
  color: #715b43;
  font-size: 0.86rem;
}

.container-tree-toggle:disabled {
  opacity: 0.25;
  cursor: default;
}

.container-tree-open {
  min-width: 0;
  min-height: 26px;
  padding: 3px 6px;
  overflow: hidden;
  color: #3e3125;
  font: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.container-tree-open:hover,
.container-tree-open:focus-visible,
.container-tree-row.active .container-tree-open {
  border-radius: 8px;
  background: #ede4d6;
  color: #274e7c;
}

.container-tree-count {
  margin-left: auto;
  padding-right: 6px;
  color: #8a7866;
  font-size: 0.74rem;
}

.container-tree-empty {
  margin: 1px 0 0;
  color: #857260;
  font-size: 0.82rem;
}

.container-tree-empty-root {
  padding: 2px 8px 4px 26px;
}

.cabinets-view {
  display: grid;
  gap: 12px;
}

.cabinets-view.hidden {
  display: none;
}

.cabinets-view-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.cabinets-view-header h2 {
  margin: 0 0 3px;
  font-size: 1.18rem;
  font-weight: 700;
}

.cabinets-view-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.cabinet-navigation-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr);
  gap: 10px;
  width: min(720px, 100%);
}

.cabinet-search-field,
.cabinet-jump-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #6f5a43;
  font-size: 0.74rem;
  font-weight: 700;
}

.cabinet-search-field input,
.cabinet-jump-field select {
  width: 100%;
  min-height: 36px;
  font-weight: 500;
}

.cabinets-view-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(77, 59, 38, .18);
}

.cabinets-view-toolbar button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.84rem;
  font-weight: 650;
}

.cabinet-organizer-workspace {
  margin: 0;
  padding: 12px 14px;
}

.cabinet-organizer-tree {
  max-height: none;
  margin-top: 10px;
  overflow: visible;
  scrollbar-gutter: auto;
}

.cabinet-organizer-tree .container-tree-group {
  padding: 12px 0 16px;
  border-top: 2px solid rgba(111, 90, 67, .28);
}

.cabinet-organizer-tree .container-tree-group:first-child {
  border-top: 0;
}

.cabinet-organizer-tree .container-tree-group-heading {
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 38px;
  padding: 4px 6px;
  background: #fffdf8;
  box-shadow: 0 1px 0 rgba(111, 90, 67, .16);
}

.cabinet-organizer-tree .container-tree-group-title {
  font-size: 0.86rem;
  font-weight: 700;
}

.cabinet-organizer-tree .container-tree-row {
  min-height: 36px;
  margin-top: 8px;
  padding-top: 5px;
  padding-bottom: 5px;
  border-top: 1px solid rgba(111, 90, 67, .18);
}

.cabinet-organizer-tree .container-tree-open {
  font-size: 0.84rem;
  font-weight: 650;
}

.cabinet-organizer-notes {
  display: grid;
  gap: 2px;
  padding: 4px 0 4px
    calc(
      31px +
      var(--organizer-note-depth, 0) * 14px
    );
}

.cabinet-organizer-note {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 0;
  border-bottom: 1px solid rgba(111, 90, 67, .12);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 450;
  text-align: left;
  cursor: pointer;
}

.cabinet-organizer-note:hover,
.cabinet-organizer-note:focus-visible {
  background: #f0e8dc;
  color: #274e7c;
}

.cabinet-organizer-note-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cabinet-organizer-note-pin {
  min-width: 18px;
  text-align: center;
}

body.rnc-cabinets-view .top-field-search,
body.rnc-cabinets-view .notebook-filter-field,
body.rnc-cabinets-view .tag-filter-field,
body.rnc-cabinets-view #manageTagsButton,
body.rnc-cabinets-view .sort-field,
body.rnc-cabinets-view .layout-toggle,
body.rnc-cabinets-view .mobile-quick-sort,
body.rnc-cabinets-view #newNoteButton,
body.rnc-cabinets-view .mobile-new-note-button {
  display: none !important;
}

@media (max-width: 700px) {
  .mobile-notebook-switcher {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 7px 10px;
    padding: 6px 8px;
    border: 1px solid rgba(77, 59, 38, 0.18);
    border-radius: 12px;
    background: rgba(255, 253, 248, 0.94);
  }

  .mobile-notebook-switcher label {
    flex: 0 0 auto;
    color: #6f5a43;
    font-size: 0.72rem;
    font-weight: 700;
  }

  .mobile-notebook-switcher select {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 34px;
    height: 34px;
    padding: 5px 28px 5px 8px;
    font-size: 0.82rem;
  }

  #newNestedContainerButton,
  #renameContainerButton,
  #deleteContainerButton {
    display: none !important;
  }

  .container-workspace {
    margin: 0 10px 7px;
    padding: 7px 8px;
  }

  .container-workspace-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .container-workspace-heading > div:first-child {
    width: 100%;
    min-width: 0;
  }

  .container-workspace-actions {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 3px;
  }

  .container-workspace-actions button {
    min-height: 30px;
    padding: 4px 6px;
    font-size: 0.74rem;
  }

  .container-breadcrumbs {
    min-height: 18px;
    font-size: 0.8rem;
  }

  .container-tree {
    max-height: 138px;
    margin-top: 4px;
  }

  .container-tree-row {
    min-height: 29px;
    padding-left: calc(var(--container-depth, 0) * 11px);
  }

  .container-tree-toggle,
  .container-tree-open {
    min-height: 28px;
  }

  .cabinets-view-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .cabinet-navigation-fields {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .cabinet-organizer-workspace {
    margin: 0;
    padding: 8px;
  }

  .cabinet-organizer-tree {
    max-height: none;
  }

  .cabinet-organizer-notes {
    padding-left: calc(
      24px +
      var(--organizer-note-depth, 0) * 10px
    );
  }
}

.main-content {
  width: min(1250px,calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.composer {
  max-width: 820px;
  margin: 0 auto 28px;
  padding: 16px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: background-color .18s ease;
}

.note-title-input {
  width: 100%;
  margin-bottom: 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 19px;
  font-weight: 700;
}

.format-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0 10px;
  padding: 7px;
  border: 1px solid rgba(120,110,98,.18);
  border-radius: 11px;
  background: rgba(255,255,255,.45);
}

.format-toolbar button,
.format-toolbar select {
  height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 4px 7px;
  background: rgba(255,255,255,.72);
  color: var(--text);
}

.format-toolbar button:hover,
.format-toolbar select:hover {
  border-color: var(--border);
  background: white;
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  margin: 0 3px;
  background: var(--border);
}

.text-colors {
  display: flex;
  align-items: center;
  gap: 4px;
}

.custom-color-label {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: white;
  font-weight: 700;
  overflow: hidden;
  cursor: pointer;
}

.custom-color-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.document-editor {
  min-height: 145px;
  max-height: 480px;
  overflow-y: auto;
  padding: 8px 3px 12px;
  outline: none;
  line-height: 1.55;
}

.document-editor:empty::before {
  content: attr(data-placeholder);
  color: #a39a8d;
  pointer-events: none;
}

.document-editor ul,
.document-editor ol,
.card-preview ul,
.card-preview ol {
  margin: 6px 0;
  padding-left: 27px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 26px;
  margin: 3px 0;
}

.check-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 21px;
  color: var(--accent-dark);
  font-size: 19px;
  line-height: 1.35;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

@media (max-width: 700px) {
  .check-toggle {
    width: 34px;
    min-width: 34px;
    height: 34px;
    margin: -4px 0;
  }
}

.check-item.checked .check-text {
  opacity: .55;
  text-decoration: line-through;
}

.check-text {
  flex: 1;
  min-width: 20px;
  outline: none;
}

.composer-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 11px;
  border-top: 1px solid rgba(120,110,98,.15);
}

.color-picker {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-swatch {
  width: 25px;
  height: 25px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
}

.color-swatch.selected {
  border-color: var(--text);
}

.save-status {
  flex: 1;
  color: var(--muted);
  font-size: 12px;
}

.composer-actions {
  display: flex;
  gap: 7px;
}

.primary-button,
.secondary-button {
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 650;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: white;
}

.secondary-button {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.6);
  color: var(--text);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 17px;
}

.note-count {
  display: grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  padding: 0 7px;
  border-radius: 999px;
  background: #e9e1d4;
  color: var(--muted);
  font-size: 12px;
}

.note-location-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  margin: -7px 0 12px;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}

.note-location-breadcrumb button {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.note-location-breadcrumb button:hover,
.note-location-breadcrumb button:focus-visible {
  color: var(--text);
}

.note-location-separator {
  color: var(--muted);
}

.note-container-browser {
  margin: 0 0 16px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 253, 248, .68);
}

.note-container-browser-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
}

.note-container-browser-heading span {
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e9e1d4;
  font-size: 10px;
}

.note-container-browser-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fill, minmax(185px, 1fr));
  gap: 7px;
}

.note-container-browser-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 48px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.note-container-browser-item:hover,
.note-container-browser-item:focus-visible {
  border-color: var(--accent);
  background: white;
}

.note-container-browser-icon {
  font-size: 18px;
  line-height: 1;
}

.note-container-browser-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.note-container-browser-copy strong,
.note-container-browser-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-container-browser-copy strong {
  font-size: 12px;
}

.note-container-browser-copy small {
  color: var(--muted);
  font-size: 10px;
}

.note-container-browser-arrow {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

@media (max-width: 700px) {
  .note-container-browser {
    padding: 8px;
  }

  .note-container-browser-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .note-container-browser-item {
    min-height: 46px;
  }
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(210px,1fr));
  align-items: start;
  gap: 12px;
}

.notes-grid.list-view {
  display: flex;
  flex-direction: column;
}

.notes-grid.list-view .note-card {
  width: 100%;
  min-height: auto;
}

.note-card {
  position: relative;
  min-height: 95px;
  max-height: 260px;
  overflow: hidden;
  padding: 13px;
  border: 1px solid rgba(120,110,98,.14);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(58,49,39,.05);
  cursor: grab;
  transition: transform .15s ease,box-shadow .15s ease;
}

.note-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(58,49,39,.08);
}

.note-card.dragging {
  opacity: .45;
}

.note-card h3 {
  margin: 0 0 7px;
  font-size: 15px;
}

.card-preview {
  position: relative;
  max-height: 145px;
  overflow: hidden;
  line-height: 1.4;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.card-preview::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18px;
  background: linear-gradient(transparent,rgba(255,255,255,.28));
  pointer-events: none;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.card-actions button {
  border: 0;
  border-radius: 8px;
  padding: 5px 7px;
  background: rgba(255,255,255,.55);
  color: var(--text);
  font-size: 11px;
}

.card-actions .note-location-link {
  max-width: 100%;
  margin-left: 14px;
  padding-right: 2px;
  padding-left: 2px;
  overflow-wrap: anywhere;
  background: transparent;
  color: var(--muted);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.card-actions .note-location-link:hover,
.card-actions .note-location-link:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.42);
}

.pin-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width:720px) {
  .rnc-update-notice {
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
    padding: 9px 12px;
    text-align: center;
  }

  .rnc-update-notice div {
    align-items: center;
    flex-direction: column;
    gap: 2px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 13px 15px;
  }

  .top-controls {
    width: 100%;
  }

  .search-input {
    flex: 1;
  }

  .main-content {
    width: calc(100% - 18px);
    padding-top: 14px;
  }

  .format-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .format-toolbar > * {
    flex: 0 0 auto;
  }

  .composer-footer {
    flex-wrap: wrap;
  }

  .save-status {
    order: 3;
    width: 100%;
    flex-basis: 100%;
  }

  .notes-grid {
    grid-template-columns: repeat(auto-fill,minmax(165px,1fr));
  }

  .notes-grid.list-view {
    display: flex;
  }
}

.control-select {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel-bg);
  color: var(--text);
  padding: 0 9px;
}

.date-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.note-display-date-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.note-display-date-controls input[type="date"],
.note-display-date-controls input[type="time"] {
  box-sizing: border-box;
  min-height: 30px;
  height: 30px;
  max-width: 132px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--text);
  font: inherit;
}

.note-display-date-controls label {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.note-card.selected {
  outline: 3px solid rgba(0, 87, 255, .55);
  outline-offset: 2px;
}

.note-card.selected::before {
  content: "✓";
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0057ff;
  color: white;
  font-size: 12px;
  font-weight: 800;
  z-index: 2;
}

.note-date {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.notes-grid.title-view {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.notes-grid.title-view .note-card {
  min-height: 0;
  max-height: none;
  padding: 9px 12px;
}

.notes-grid.title-view .card-preview,
.notes-grid.title-view .card-actions,
.notes-grid.title-view .note-date,
.notes-grid.title-view .pin-label {
  display: none;
}

.notes-grid.title-view .note-card h3 {
  margin: 0;
}

.drop-indicator {
  position: fixed;
  z-index: 9999;
  height: 4px;
  border-radius: 3px;
  background: #0057ff;
  box-shadow: 0 0 0 1px rgba(255,255,255,.9);
  pointer-events: none;
}

.context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 160px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-bg);
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
}

.context-menu button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 8px 10px;
  text-align: left;
  color: var(--text);
}

.context-menu button:hover {
  background: #eee7dc;
}

.note-move-drop-panel {
  position: fixed;
  z-index: 20500;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  width: min(390px, calc(100vw - 36px));
  max-height: calc(100dvh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 2px solid #8a7457;
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: 0 18px 55px rgba(38, 30, 21, .32);
}

.note-move-drop-heading {
  display: grid;
  gap: 3px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #d7c9b7;
  background: #f3eadc;
  color: #352a20;
}

.note-move-drop-heading strong {
  font-size: 1rem;
}

.note-move-drop-heading span {
  color: #6f6255;
  font-size: .82rem;
}

.note-move-drop-list {
  display: grid;
  gap: 5px;
  padding: 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.note-move-drop-target {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #d7c9b7;
  border-radius: 10px;
  background: #fff;
  color: #352a20;
  font-size: .86rem;
  font-weight: 650;
}

.note-move-drop-target.active {
  border-color: #9a671a;
  background: #fff0c9;
  box-shadow: inset 0 0 0 2px rgba(154, 103, 26, .22);
}

@media (max-width: 700px) {
  .note-move-drop-panel {
    display: none;
  }
}

.notes-section + .notes-section {
  margin-top: 26px;
}


.note-card[data-view="trash"] {
  cursor: default;
}

.format-toolbar #undoButton,
.format-toolbar #redoButton {
  font-size: 18px;
  line-height: 1;
}



/* RNC 0.3.2 Pop-Out Editor */

.editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(45, 40, 34, .28);
  backdrop-filter: blur(2px);
}

.editor-modal {
  position: fixed;
  z-index: 910;
  top: 50%;
  left: 50%;
  width: min(850px, calc(100vw - 34px));
  max-height: calc(100vh - 48px);
  margin: 0;
  transform: translate(-50%, -50%);
  overflow-y: auto;
  box-shadow: 0 24px 70px rgba(40, 34, 27, .28);
}

.new-note-button {
  white-space: nowrap;
}

body.editor-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .editor-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 18px);
  }

  .top-controls {
    flex-wrap: wrap;
  }
}


/* RNC 0.3.2A */

.editor-modal {
  top: 18px;
  bottom: 18px;
  left: 50%;
  width: min(850px, calc(100vw - 34px));
  max-height: none;
  transform: translateX(-50%);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.document-editor {
  min-height: 180px;
  max-height: min(52vh, 520px);
  overflow-y: auto;
}

.composer-footer {
  position: sticky;
  bottom: 0;
  z-index: 4;
  margin: 0 -16px -16px;
  padding: 12px 16px 16px;
  background: inherit;
}

.format-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(255, 253, 248, .96);
}

.check-text {
  min-height: 1.45em;
  min-width: 40px;
  cursor: text;
}

@media (max-width: 720px) {
  .editor-modal {
    top: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }

  .document-editor {
    max-height: 50vh;
  }
}

/* RNC 0.3.2A card movement */

.note-card {
  position: relative;
  cursor: default;
  user-select: text;
}

.drag-handle {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 4;

  display: grid;
  place-items: center;

  width: 26px;
  height: 26px;

  border: 1px solid rgba(120,110,98,.18);
  border-radius: 8px;

  background: rgba(255,255,255,.62);
  color: var(--muted);

  font-size: 17px;
  line-height: 1;

  cursor: grab;
  user-select: none;

  opacity: .35;
  transition: opacity .15s ease;
}

.note-card:hover .drag-handle,
.drag-handle:focus-visible {
  opacity: 1;
}

.drag-handle:active {
  cursor: grabbing;
}

.note-card.selected .drag-handle {
  right: 34px;
}

.drop-indicator {
  height: 5px;
  background: #0057ff;
  box-shadow:
    0 0 0 1px white,
    0 2px 7px rgba(0,87,255,.35);
}


/* RNC 0.3.2B */

.editor-modal {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  max-height: calc(100vh - 36px);
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.note-metadata {
  margin: -1px 0 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.document-editor {
  flex: 0 1 auto;
  min-height: 150px;
  max-height: min(58vh, 560px);
  overflow-y: auto;

  /*
    Comfortable breathing room after final line.
  */
  padding-bottom: 56px;
}

.composer-footer {
  position: static;
  flex: 0 0 auto;
  margin: 0 -16px -16px;
  padding: 12px 16px 16px;
  background: inherit;
}

.format-toolbar {
  position: static;
  flex: 0 0 auto;
}

.danger-button {
  border: 1px solid #b76054;
  border-radius: 10px;
  padding: 8px 14px;
  background: rgba(255,255,255,.55);
  color: #9b3d34;
  font-weight: 650;
}

.danger-button:hover {
  background: rgba(183,96,84,.12);
}

@media (max-width: 720px) {
  .editor-modal {
    top: 50%;
    bottom: auto;
    max-height: calc(100vh - 16px);
    transform: translate(-50%, -50%);
  }

  .document-editor {
    max-height: 55vh;
    padding-bottom: 48px;
  }
}


/* RNC 0.3.2C */

.document-editor {
  padding-top: 28px;
  padding-bottom: 28px;
}


/* RNC 0.3.3 */

/*
  Packed / masonry-style board.
  Pinned and All Notes are separate grids, so each
  section packs independently.
*/
.notes-grid.packed-view {
  display: block;
  column-width: 230px;
  column-gap: 14px;
}

.notes-grid.packed-view .note-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 14px;
  vertical-align: top;

  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}

/*
  Packed is an automatic layout, so don't stretch cards.
*/
.notes-grid.packed-view .note-card {
  min-height: 0;
}

/*
  Horizontal gesture protection while editing.
  Vertical scrolling remains normal.
*/
html,
body {
  overscroll-behavior-x: none;
}

/* Tablet-width Android PWAs are wider than the phone breakpoint. Prevent the
   browser-owned pull-to-refresh gesture on every coarse-pointer device. */
@media (pointer: coarse) {
  html,
  body {
    overscroll-behavior-y: none;
  }
}

body.editor-open {
  overscroll-behavior: none;
}

.editor-backdrop,
.editor-modal,
.document-editor {
  overscroll-behavior-x: none;
}

.editor-modal,
.document-editor {
  touch-action: pan-y;
}

@media (max-width: 720px) {
  .notes-grid.packed-view {
    column-width: 165px;
    column-gap: 10px;
  }

  .notes-grid.packed-view .note-card {
    margin-bottom: 10px;
  }
}


/* RNC 0.3.3B — true packed masonry + scoped swipe */

/*
  Restore normal browser horizontal navigation when
  the note editor is not open.
*/
html,
body {
  overscroll-behavior-x: auto;
}

/*
  Packed uses measured CSS-grid row spans instead of
  multi-column layout.
*/
.notes-grid.packed-view {
  display: grid;
  grid-template-columns:
    repeat(auto-fill, minmax(210px, 1fr));
  grid-auto-rows: 8px;
  gap: 12px;
  align-items: start;

  column-width: unset;
  column-gap: unset;
}

.notes-grid.packed-view .note-card {
  display: block;
  width: 100%;
  margin: 0;

  break-inside: auto;
  -webkit-column-break-inside: auto;
  page-break-inside: auto;
}

@media (max-width: 720px) {
  .notes-grid.packed-view {
    grid-template-columns:
      repeat(auto-fill, minmax(165px, 1fr));
    grid-auto-rows: 8px;
    gap: 10px;
  }

  .notes-grid.packed-view .note-card {
    margin: 0;
  }
}

/* RNC 0.3.3C */

.notes-grid.packed-view {
  grid-auto-flow: dense;
}

/*
  Browser page navigation remains browser-native.
  RNC no longer globally suppresses horizontal page gestures.
*/
html,
body,
body.editor-open {
  overscroll-behavior-x: auto;
}


/* RNC 0.3.4A — durable note images */

.note-image {
  display: block;
  max-width: 100%;
  height: auto;

  margin: 12px 0;

  border-radius: 8px;

  cursor: pointer;
}

.document-editor .note-image {
  max-height: 65vh;
  object-fit: contain;
}

.note-image.image-selected {
  outline: 3px solid rgba(0, 87, 255, .65);
  outline-offset: 3px;
}

.card-preview .note-image {
  max-width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: 6px;
}

/* =========================================================
   RNC 0.3.4B — Image sizing + full screen
   ========================================================= */

.note-image {
  width: 50%;
  max-width: 100%;
  height: auto;
}

.image-size-controls {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);

  z-index: 12000;

  display: flex;
  align-items: center;
  gap: 7px;

  padding: 8px 10px;

  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(0, 0, 0, .14);
  border-radius: 12px;

  box-shadow:
    0 8px 30px rgba(0, 0, 0, .18);
}

.image-size-controls.hidden {
  display: none;
}

.image-size-label {
  margin-right: 3px;

  font-size: 12px;
  opacity: .65;
}

.image-size-controls button {
  border: 1px solid rgba(0, 0, 0, .14);
  border-radius: 8px;

  background: white;

  padding: 6px 9px;

  cursor: pointer;
}

.image-size-controls button.active {
  font-weight: 700;

  outline: 2px solid rgba(0, 87, 255, .38);
}

.image-fullscreen-viewer {
  position: fixed;
  inset: 0;

  z-index: 20000;

  display: flex;
  align-items: center;
  justify-content: center;
}

.image-fullscreen-viewer.hidden {
  display: none;
}

.image-fullscreen-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(0, 0, 0, .88);
}

.image-fullscreen-content {
  position: relative;

  z-index: 1;

  max-width: 96vw;
  max-height: 94vh;

  display: flex;
  align-items: center;
  justify-content: center;
}

.image-fullscreen-content img {
  max-width: 96vw;
  max-height: 94vh;

  width: auto;
  height: auto;

  object-fit: contain;

  border-radius: 6px;
}

.image-fullscreen-close {
  position: absolute;
  top: -42px;
  right: 0;

  width: 36px;
  height: 36px;

  border: 0;
  border-radius: 999px;

  font-size: 28px;
  line-height: 32px;

  cursor: pointer;
}

body.image-viewer-open {
  overflow: hidden;
}


/* Full-screen note editor */

.composer.note-fullscreen {
  position: fixed !important;

  inset: 18px !important;

  width: auto !important;
  max-width: none !important;

  height: calc(100vh - 36px) !important;
  max-height: none !important;

  margin: 0 !important;

  display: flex;
  flex-direction: column;

  z-index: 11000;
}

.composer.note-fullscreen .document-editor {
  flex: 1 1 auto;

  max-height: none !important;
  min-height: 0;

  overflow-y: auto;
}

body.note-fullscreen-open {
  overflow: hidden;
}

@media (max-width: 700px) {
  .composer.note-fullscreen {
    inset: 0 !important;

    height: 100vh !important;

    border-radius: 0 !important;
  }

  .image-size-controls {
    bottom: 10px;

    max-width: calc(100vw - 20px);

    overflow-x: auto;
  }

  .image-size-label {
    display: none;
  }
}

/* =========================================================
   RNC 0.3.4B UI correction
   Keep images inside editor + controls inside note
   ========================================================= */

.document-editor {
  overflow-x: hidden;
  box-sizing: border-box;
  max-width: 100%;
}

.document-editor .note-image {
  display: block;
  box-sizing: border-box;

  max-width: 100% !important;
  height: auto !important;

  margin-left: 0;
  margin-right: auto;
}

/*
  Image tools now belong to the open note instead of
  floating against the browser viewport.
*/
.image-size-controls {
  position: static;

  left: auto;
  bottom: auto;
  transform: none;

  width: 100%;
  box-sizing: border-box;

  margin: 10px 0 12px;

  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;

  gap: 7px;

  padding: 8px 10px;

  z-index: 5;
}

.image-size-controls.hidden {
  display: none;
}

.composer.note-fullscreen .image-size-controls {
  flex: 0 0 auto;
}

@media (max-width: 700px) {
  .image-size-controls {
    position: static;

    max-width: 100%;

    margin: 8px 0 10px;

    overflow-x: visible;
  }
}

/* RNC 0.3.4B — image framing refinement */

.document-editor .note-image {
  max-width: calc(100% - 24px) !important;

  margin-top: 12px;
  margin-bottom: 12px;
  margin-left: 12px;
  margin-right: 12px;
}

/* RNC 0.3.4B — correct note full-screen positioning */

.composer.note-fullscreen {
  top: 18px !important;
  right: 18px !important;
  bottom: 18px !important;
  left: 18px !important;

  transform: none !important;

  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
}

@media (max-width: 700px) {
  .composer.note-fullscreen {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;

    transform: none !important;
  }
}

/* RNC 0.3.4B — keep footer actions compact when image tools are visible */

.composer-footer {
  align-items: center;
}

.composer-actions {
  flex: 0 0 auto;
  align-items: center;
}

.composer-actions button {
  flex: 0 0 auto !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;

  padding: 8px 14px !important;

  line-height: 1.2 !important;
  white-space: nowrap;
}

#fullscreenNoteButton {
  white-space: nowrap;
}

/* =========================================================
   RNC 0.3.5A — Tags / Labels
   ========================================================= */

.note-tags-editor {
  display: flex;
  align-items: center;
  gap: 9px;

  margin-top: 8px;
  margin-bottom: 10px;

  padding: 8px 10px;

  border: 1px solid rgba(120, 110, 98, .16);
  border-radius: 10px;

  background: rgba(255, 255, 255, .28);
}

.note-tags-editor label {
  flex: 0 0 auto;

  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

#noteTagsInput {
  flex: 1 1 auto;

  min-width: 0;

  border: 0;
  outline: 0;

  background: transparent;

  color: inherit;
  font: inherit;
  font-size: 13px;
}

#noteTagsInput::placeholder {
  color: var(--muted);
  opacity: .7;
}


/* Card tag pills */

.note-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;

  margin-top: 10px;
}

.note-tag-pill {
  display: inline-flex;
  align-items: center;

  max-width: 100%;

  padding: 3px 8px;

  border: 1px solid rgba(80, 72, 62, .14);
  border-radius: 999px;

  background: rgba(255, 255, 255, .48);

  color: rgba(55, 50, 44, .78);

  font-size: 11px;
  line-height: 1.25;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/*
  Title-only view stays title-oriented.
  Tag filtering will come in 0.3.5B.
*/
.notes-grid.title-view .note-tag-list {
  display: none;
}


@media (max-width: 700px) {
  .note-tags-editor {
    align-items: flex-start;
  }
}

/* RNC 0.3.5B — clickable tag filters */

button.note-tag-pill {
  appearance: none;
  cursor: pointer;
  font-family: inherit;
}

button.note-tag-pill:hover {
  background: rgba(255, 255, 255, .78);
  border-color: rgba(80, 72, 62, .28);
}

button.note-tag-pill:active {
  transform: translateY(1px);
}

#tagFilterSelect {
  min-width: 110px;
}

/* =========================================================
   RNC 0.3.5C — Manage Tags
   ========================================================= */

.manage-tags-button {
  white-space: nowrap;
}

.manage-tags-modal {
  position: fixed;
  inset: 0;

  z-index: 21000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
}

.manage-tags-modal.hidden {
  display: none;
}

/* Desktop read-only reference note picker */
.reference-note-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 32000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.reference-note-picker-modal.hidden {
  display: none;
}

.reference-note-picker-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(35, 31, 27, .48);
}

.reference-note-picker-panel {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(620px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 40px));
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-bg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .28);
}

.reference-note-picker-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.reference-note-picker-heading h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

.reference-note-picker-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

#referenceNotePickerClose {
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 25px;
  line-height: 1;
}

#referenceNotePickerSearch {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffdf8;
  color: var(--text);
  font: inherit;
}

.reference-note-picker-list {
  display: grid;
  gap: 8px;
  min-height: 90px;
  padding-right: 3px;
  overflow-y: auto;
}

.reference-note-choice {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fffdf8;
  color: var(--text);
  text-align: left;
}

.reference-note-choice:hover,
.reference-note-choice:focus-visible {
  border-color: #8b7659;
  background: #f7f0e4;
}

.reference-note-choice strong,
.reference-note-choice span,
.reference-note-choice small {
  display: block;
}

.reference-note-choice span {
  overflow: hidden;
  color: var(--text);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-note-choice small {
  color: var(--muted);
  font-weight: 400;
}

.reference-note-picker-empty {
  margin: auto;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .desktop-reference-note-button {
    display: none !important;
  }
}

.manage-tags-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(35, 31, 27, .55);
}

.manage-tags-panel {
  position: relative;
  z-index: 1;

  width: min(560px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 40px));

  overflow: hidden;

  display: flex;
  flex-direction: column;

  border: 1px solid rgba(100, 90, 78, .20);
  border-radius: 18px;

  background: #fffdf8;

  box-shadow:
    0 20px 60px rgba(0, 0, 0, .28);
}

.manage-tags-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;

  padding: 20px 22px 16px;

  border-bottom:
    1px solid rgba(120, 110, 98, .14);
}

.manage-tags-heading h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.manage-tags-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.manage-tags-close {
  flex: 0 0 auto;

  width: 34px;
  height: 34px;

  border: 1px solid rgba(80, 72, 62, .14);
  border-radius: 999px;

  background: rgba(255, 255, 255, .65);

  font-size: 24px;
  line-height: 28px;

  cursor: pointer;
}

.manage-tags-list {
  overflow-y: auto;

  padding: 10px 14px 16px;
}

.manage-tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  padding: 12px 8px;

  border-bottom:
    1px solid rgba(120, 110, 98, .11);
}

.manage-tag-row:last-child {
  border-bottom: 0;
}

.manage-tag-info {
  min-width: 0;

  display: flex;
  flex-direction: column;

  gap: 2px;
}

.manage-tag-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-tag-info span {
  color: var(--muted);
  font-size: 12px;
}

.manage-tag-actions {
  flex: 0 0 auto;

  display: flex;
  gap: 7px;
}

.manage-tag-actions button {
  padding: 7px 11px;

  border-radius: 9px;

  cursor: pointer;
}

.manage-tags-empty {
  padding: 30px 12px;

  text-align: center;

  color: var(--muted);
}

body.manage-tags-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .manage-tag-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .manage-tag-actions {
    width: 100%;
  }
}

/* =========================================================
   RNC 0.3.6A — Notebooks
   ========================================================= */

.note-notebook-editor {
  display: flex;
  align-items: center;
  gap: 9px;

  margin-top: 8px;
  margin-bottom: 8px;

  padding: 8px 10px;

  border: 1px solid rgba(120, 110, 98, .16);
  border-radius: 10px;

  background: rgba(255, 255, 255, .28);
}

.note-notebook-editor label {
  flex: 0 0 auto;

  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

#noteNotebookSelect {
  flex: 1 1 auto;
  min-width: 0;
}

#notebookFilterSelect {
  min-width: 120px;
}

@media (max-width: 700px) {
  .note-notebook-editor {
    align-items: flex-start;
  }
}

/* RNC 0.3.6A — notebook top-bar sizing polish */

#notebookFilterSelect {
  min-width: 180px;
  width: 180px;
  flex: 0 0 180px;
}

#newNotebookButton {
  width: auto !important;
  min-width: 118px;
  height: 38px;

  padding: 0 14px !important;

  white-space: nowrap;
  line-height: 1;
}

/* =========================================================
   RNC 0.3.6A — top control labels
   ========================================================= */

.top-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;

  min-width: 0;
}

.top-field-label {
  padding-left: 4px;

  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1;

  letter-spacing: .03em;
}

.top-field > select,
.top-field > input {
  margin: 0;
}

.top-field-search {
  flex: 1 1 220px;
}

.top-field-search .search-input {
  width: 100%;
}


/* Label the four layout choices as one View group */

.layout-toggle {
  position: relative;

  padding-top: 13px;
}

.layout-toggle::before {
  content: "View";

  position: absolute;
  top: 0;
  left: 4px;

  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1;

  letter-spacing: .03em;
}

/* RNC 0.3.6A — correct labeled Notebook field sizing */

.top-field #notebookFilterSelect {
  flex: 0 0 auto;
  width: 180px;
  min-width: 180px;
  height: 38px;
}


/* RNC 0.3.6A — top-bar grouping polish */

#newNotebookButton,
#manageTagsButton {
  margin-left: 8px;
  margin-right: 4px;
}


/* RNC 0.3.6A — proper top toolbar flex layout */

.top-controls .top-field {
  flex: 0 0 auto;
}

.top-controls .top-field-search {
  flex: 1 1 220px;
  min-width: 150px;
  max-width: 300px;
}

#newNoteButton,
#newNotebookButton,
#manageTagsButton {
  flex: 0 0 auto;
}

#newNotebookButton,
#manageTagsButton {
  margin-left: 0;
  margin-right: 0;
}

.top-field #notebookFilterSelect {
  width: 180px;
  min-width: 180px;
  flex: none;
}

.top-field #tagFilterSelect {
  width: 135px;
  min-width: 135px;
  flex: none;
}

.top-field #sortSelect {
  width: 175px;
  min-width: 175px;
  flex: none;
}

.top-controls .layout-toggle {
  flex: 0 0 auto;
}

.top-controls {
  gap: 12px;
  min-width: 0;
}

/* RNC 0.3.6A — proper top toolbar flex layout */

.top-controls .top-field {
  flex: 0 0 auto;
}

.top-controls .top-field-search {
  flex: 1 1 220px;
  min-width: 150px;
  max-width: 300px;
}

#newNoteButton,
#newNotebookButton,
#manageTagsButton {
  flex: 0 0 auto;
}

#newNotebookButton,
#manageTagsButton {
  margin-left: 0;
  margin-right: 0;
}

.top-field #notebookFilterSelect {
  width: 180px;
  min-width: 180px;
  flex: none;
}

.top-field #tagFilterSelect {
  width: 135px;
  min-width: 135px;
  flex: none;
}

.top-field #sortSelect {
  width: 175px;
  min-width: 175px;
  flex: none;
}

.top-controls .layout-toggle {
  flex: 0 0 auto;
}

.top-controls {
  gap: 12px;
  min-width: 0;
}

/* RNC 0.3.6A — two-row application header */

.topbar {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.top-controls {
  width: 100%;
  flex: none;

  justify-content: flex-start;
  align-items: flex-end;

  flex-wrap: wrap;

  gap: 12px 14px;
}

/* Keep the labeled controls together */
.top-controls .top-field {
  flex: 0 0 auto;
}

/* Search may grow when room is available */
.top-controls .top-field-search {
  flex: 1 1 220px;
  min-width: 190px;
  max-width: 360px;
}

/* Actions stay compact */
#newNoteButton,
#newNotebookButton,
#manageTagsButton {
  flex: 0 0 auto;
  align-self: flex-end;
}

/* Keep View together */
.top-controls .layout-toggle {
  flex: 0 0 auto;
  align-self: flex-end;
}

/* RNC 0.3.6A — compact labeled header */

/* Put branding and controls back on one row */
.topbar {
  flex-direction: row !important;
  align-items: center !important;
  gap: 22px !important;

  padding-top: 12px !important;
  padding-bottom: 12px !important;
}

/* Branding stays compact and does not get squeezed */
.brand {
  flex: 0 0 auto;
  min-width: 370px;
}

/* Controls remain on the same row */
.top-controls {
  flex: 1 1 auto;
  width: auto;

  display: flex;
  flex-wrap: nowrap;

  justify-content: flex-end;
  align-items: flex-end;

  gap: 10px;

  min-width: 0;
}

/* Small labels only */
.top-field-label {
  height: auto;
  margin: 0 0 3px 4px;

  font-size: 9px;
  line-height: 1;
}

/* Compact control heights */
.top-controls .control-select,
.top-controls .search-input,
#newNoteButton,
#newNotebookButton,
#manageTagsButton {
  height: 38px !important;
}

/* Compact field widths */
.top-field #notebookFilterSelect {
  width: 150px;
  min-width: 150px;
}

.top-controls .top-field-search {
  flex: 0 1 240px;
  min-width: 160px;
  max-width: 240px;
}

.top-field #tagFilterSelect {
  width: 120px;
  min-width: 120px;
}

.top-field #sortSelect {
  width: 155px;
  min-width: 155px;
}

/* Buttons line up with the field controls */
#newNoteButton,
#newNotebookButton,
#manageTagsButton {
  margin-top: 12px;
  padding-left: 13px !important;
  padding-right: 13px !important;
}

/* View remains compact */
.top-controls .layout-toggle {
  margin-top: 0;
  padding-top: 12px;
}

/* Only stack on genuinely smaller screens */
@media (max-width: 1150px) {
  .topbar {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .brand {
    min-width: 0;
  }

  .top-controls {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

/* RNC 0.3.6A — final compact header layout */

.topbar {
  display: grid !important;
  grid-template-columns: 330px minmax(0, 1fr);
  align-items: center !important;
  column-gap: 20px !important;

  padding: 10px 22px !important;
}

/* Branding owns its column */
.brand {
  min-width: 0 !important;
  width: 330px;
  overflow: hidden;
}

/* Controls stay entirely in their own column */
.top-controls {
  min-width: 0;
  width: 100%;

  display: flex;
  flex-wrap: nowrap;

  justify-content: flex-start;
  align-items: flex-end;

  gap: 10px;
}

/* Slightly tighter fields so the whole toolbar fits */
.top-field #notebookFilterSelect {
  width: 135px;
  min-width: 135px;
}

.top-controls .top-field-search {
  flex: 1 1 190px;
  min-width: 150px;
  max-width: 215px;
}

.top-field #tagFilterSelect {
  width: 105px;
  min-width: 105px;
}

.top-field #sortSelect {
  width: 140px;
  min-width: 140px;
}

/* Keep action buttons compact */
#newNoteButton,
#newNotebookButton,
#manageTagsButton {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Do not let the layout icons expand */
.top-controls .layout-toggle {
  flex: 0 0 auto;
}

/* Stack only when the screen genuinely needs it */
@media (max-width: 1250px) {
  .topbar {
    grid-template-columns: 1fr !important;
    row-gap: 10px;
  }

  .brand {
    width: auto;
  }

  .top-controls {
    flex-wrap: wrap;
  }
}

/* RNC 0.3.6A — lighter top toolbar typography */

.top-controls .control-select,
.top-controls .search-input,
#newNoteButton,
#newNotebookButton,
#manageTagsButton {
  font-size: 14px !important;
  font-weight: 500;
}

#newNoteButton {
  font-weight: 650;
}

.top-field-label,
.layout-toggle::before {
  font-size: 9px;
  font-weight: 650;
}

.top-controls .layout-button,
.top-controls .view-button {
  font-size: 14px;
}

/* RNC 0.3.6A — compact toolbar typography + smartphone layout */

/* Slightly smaller desktop toolbar text */
.top-controls .control-select,
.top-controls .search-input,
#newNoteButton,
#newNotebookButton,
#manageTagsButton {
  font-size: 12px !important;
}

#newNoteButton {
  font-weight: 650;
}

.top-field-label,
.layout-toggle::before {
  font-size: 8px !important;
}

.top-controls .layout-button,
.top-controls .view-button {
  font-size: 12px !important;
}


/* =========================================================
   Smartphone / narrow-screen toolbar
   ========================================================= */

@media (max-width: 700px) {
  .topbar {
    display: block !important;
    padding: 10px 12px !important;
  }

  .brand {
    width: auto !important;
    margin-bottom: 10px;
  }

  .top-controls {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
    width: 100%;
  }

  /* New Note gets a full-width primary position */
  #newNoteButton {
    grid-column: 1 / -1;
    width: 100%;
    margin: 0 !important;
  }

  /* Notebook and Search can span full width where useful */
  .top-field-search {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none !important;
  }

  .top-field-search .search-input {
    width: 100%;
  }

  .top-field #notebookFilterSelect,
  .top-field #tagFilterSelect,
  .top-field #sortSelect {
    width: 100% !important;
    min-width: 0 !important;
  }

  .top-field {
    width: 100%;
  }

  /* Action buttons fit their grid cells */
  #newNotebookButton,
  #manageTagsButton {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  /* View controls get their own full-width row */
  .layout-toggle {
    grid-column: 1 / -1;
    justify-content: flex-start;
    width: 100%;
  }

  /* Keep controls finger-friendly even with smaller text */
  .top-controls .control-select,
  .top-controls .search-input,
  .quick-save-sync-button,
  #newNoteButton,
  #newNotebookButton,
  #manageTagsButton {
    min-height: 40px;
  }
}

/* RNC 0.3.6A — compact brand block */

.brand {
  gap: 10px;
}

.brand-mark {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px;
  border-radius: 14px;
  font-size: 25px !important;
}

.brand h1 {
  font-size: 20px !important;
  line-height: 1.08;
}

.creator {
  font-size: 11px !important;
  margin-top: 2px;
}

/* Slightly narrower reserved branding column */
.topbar {
  grid-template-columns: 285px minmax(0, 1fr) !important;
}

/* =========================================================
   RNC 0.3.6B — Manage Cabinets
   ========================================================= */

.manage-notebooks-modal {
  position: fixed;
  inset: 0;

  z-index: 21000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
}

.manage-notebooks-modal.hidden {
  display: none;
}

.manage-notebooks-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(35, 31, 27, .55);
}

.manage-notebooks-panel {
  position: relative;
  z-index: 1;

  width: min(560px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 40px));

  overflow: hidden;

  display: flex;
  flex-direction: column;

  border: 1px solid rgba(100, 90, 78, .20);
  border-radius: 18px;

  background: #fffdf8;

  box-shadow:
    0 20px 60px rgba(0, 0, 0, .28);
}

.manage-notebooks-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;

  padding: 20px 22px 16px;

  border-bottom:
    1px solid rgba(120, 110, 98, .14);
}

.manage-notebooks-heading h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.manage-notebooks-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.manage-notebooks-close {
  width: 34px;
  height: 34px;

  border: 1px solid rgba(80, 72, 62, .14);
  border-radius: 999px;

  background: rgba(255, 255, 255, .65);

  font-size: 24px;
  cursor: pointer;
}

.manage-notebooks-list {
  overflow-y: auto;
  padding: 10px 14px 16px;
}

.manage-notebook-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  padding: 12px 8px;

  border-bottom:
    1px solid rgba(120, 110, 98, .11);
}

.manage-notebook-row:last-child {
  border-bottom: 0;
}

.manage-notebook-info {
  min-width: 0;

  display: flex;
  flex-direction: column;

  gap: 2px;
}

.manage-notebook-info span {
  color: var(--muted);
  font-size: 12px;
}

.manage-notebook-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.manage-notebook-actions button {
  padding: 7px 11px;
  border-radius: 9px;
  cursor: pointer;
}

.manage-notebooks-empty {
  padding: 30px 12px;

  text-align: center;
  color: var(--muted);
}

body.manage-notebooks-open {
  overflow: hidden;
}

body.manage-templates-open {
  overflow: hidden;
}

body.template-name-open {
  overflow: hidden;
}

.template-name-modal {
  position: fixed;
  inset: 0;
  z-index: 22000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.template-name-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 31, 27, .6);
}

.template-name-panel {
  position: relative;
  z-index: 1;
  width: min(430px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid rgba(100, 90, 78, .2);
  border-radius: 18px;
  background: #fffdf8;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}

.template-name-panel h2 {
  margin: 0 0 6px;
}

.template-name-panel p {
  margin: 0 0 18px;
  color: var(--muted);
}

.template-name-panel label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.template-name-panel input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.template-name-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.manage-templates-panel {
  width: min(720px, calc(100vw - 32px));
}

.manage-template-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 13px 8px;
  border-bottom: 1px solid rgba(120, 110, 98, .11);
}

.manage-template-row:last-child {
  border-bottom: 0;
}

.manage-template-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.manage-template-preview {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-template-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.manage-template-actions button {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, .68);
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}

.manage-template-actions .primary-button {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.manage-template-actions .danger-button {
  border-color: #b76054;
  color: #9b3d34;
}

@media (max-width: 620px) {
  .manage-templates-modal {
    padding: 10px;
  }

  .manage-templates-panel {
    width: min(370px, calc(100vw - 20px));
    max-height: calc(100dvh - 20px);
  }

  .manage-template-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .manage-template-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manage-template-actions button {
    width: 100%;
  }
}

.manage-containers-toolbar {
  display: flex;
  justify-content: flex-start;
  padding: 8px 12px 3px;
}

.manage-containers-panel {
  width: min(920px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 28px));
}

.manage-containers-panel .manage-notebooks-heading {
  gap: 12px;
  padding: 13px 16px 10px;
}

.manage-containers-panel .manage-notebooks-heading h2 {
  margin-bottom: 2px;
  font-size: 18px;
}

.manage-containers-panel .manage-notebooks-heading p {
  max-width: 780px;
  font-size: 12px;
  line-height: 1.35;
}

.manage-containers-panel .manage-notebooks-close {
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  font-size: 21px;
}

.manage-containers-toolbar button {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 0.82rem;
}

.manage-containers-list {
  padding: 4px 10px 10px;
}

.manage-container-group-title {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 7px 5px;
  border-bottom: 1px solid rgba(120, 110, 98, .11);
  background: #fffdf8;
  color: #6f5a43;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.manage-container-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding-top: 6px;
  padding-right: 6px;
  padding-bottom: 6px;
  padding-left: calc(
    6px +
    var(--manage-container-depth, 0) * 14px
  );
}

.manage-container-info {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  column-gap: 7px;
  align-items: center;
  min-width: 0;
  line-height: 1.15;
}

.manage-container-info strong {
  font-size: 0.86rem;
  font-weight: 700;
}

.manage-container-info > span:not(.manage-container-drag-handle) {
  font-size: 0.7rem;
}

.manage-container-info > :not(.manage-container-drag-handle) {
  grid-column: 2;
}

.manage-container-drag-handle {
  grid-column: 1;
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  width: 28px;
  min-height: 36px;
  border: 1px solid rgba(120, 100, 76, .22);
  border-radius: 9px;
  background: #f4ede2;
  color: #6f5a43 !important;
  font-size: 19px !important;
  line-height: 1;
  touch-action: none;
  user-select: none;
}

.manage-container-drag-handle:active {
  cursor: grabbing;
}

.manage-container-location {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.manage-container-root-drop {
  margin: 4px 7px 6px;
  padding: 6px 9px;
  border: 1px dashed #aa9578;
  border-radius: 9px;
  background: #faf6ef;
  color: #6f5a43;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.manage-container-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 4px;
}

.manage-container-actions button {
  min-height: 29px;
  padding: 4px 7px;
  font-size: 0.76rem;
  white-space: nowrap;
}

.manage-container-actions .move-button {
  min-width: 29px;
  padding-right: 6px;
  padding-left: 6px;
}

body.manage-containers-open {
  overflow: hidden;
}

@media (max-width: 780px) {
  .manage-containers-modal {
    padding: 10px;
  }

  .manage-containers-panel {
    width: calc(100vw - 20px);
    min-width: 0;
  }

  .manage-containers-list {
    min-width: 0;
  }

  .manage-container-info {
    min-width: 0;
  }

  .manage-container-row {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    padding-left: calc(
      8px +
      var(--manage-container-depth, 0) * 12px
    );
  }

  .manage-container-actions {
    display: grid;
    grid-template-columns:
      repeat(4, minmax(0, 1fr));
    justify-content: flex-start;
    width: 100%;
    gap: 4px;
  }

  .manage-container-actions button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .manage-container-actions {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .manage-notebooks-panel:not(.manage-containers-panel)
    .manage-notebook-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .manage-notebooks-panel:not(.manage-containers-panel)
    .manage-notebook-actions {
    width: 100%;
  }
}

/* 0.3.6C - Manage Tags / Notebook ordering */

.manage-tags-create {
  display: flex;
  justify-content: flex-start;
  margin: 12px 0 14px;
}

.manage-tags-create button {
  white-space: nowrap;
}

.manage-notebook-actions .move-button {
  min-width: 34px;
  padding-left: 8px;
  padding-right: 8px;
}

.manage-notebook-actions .move-button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* 0.3.7A - Note reminders */

.note-reminder-editor {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.note-reminder-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.note-reminder-field label {
  font-size: 12px;
}

.note-reminder-field input {
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
}

.note-reminder {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.78;
}

.note-reminder.overdue {
  text-decoration: underline;
}

.note-linked-tasks {
  width: fit-content;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid #b9a989;
  border-radius: 999px;
  background: #f6efe2;
  color: #684812;
  font-size: 12px;
  font-weight: 750;
}

.note-linked-drawings {
  display: grid;
  grid-template-columns: 54px auto;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid #9aa882;
  border-radius: 999px;
  background: #eef4e7;
  color: #365826;
  font-size: 12px;
  font-weight: 750;
}

.note-linked-drawings canvas {
  display: block;
  width: 54px;
  height: 36px;
  border: 1px solid #c9c1b5;
  border-radius: 5px;
  background: #fff;
}

.note-task-links-editor {
  min-width: 160px;
}

.note-task-links-editor button,
.note-drawing-links-editor button {
  min-height: 34px;
}

#noteTaskLinksSummary {
  color: #70675b;
  font-size: 12px;
}

.rnc-note-task-links-panel {
  width: min(620px, 100%);
}

.rnc-note-task-link-list {
  display: grid;
  gap: 8px;
  max-height: 55vh;
  overflow: auto;
}

.rnc-note-task-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid #ded4c5;
  border-radius: 10px;
}

.rnc-note-task-link-row label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.rnc-note-task-link-row label span {
  display: grid;
  min-width: 0;
}

.rnc-note-task-link-row small {
  color: #70675b;
}

.task-search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.task-search-result-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #d7cbb9;
  border-left: 4px solid #8b6f47;
  border-radius: 12px;
  background: #fffdf9;
}

.task-search-result-card span {
  color: #776d60;
  font-size: 12px;
}

.task-search-result-card p {
  margin: 0;
  color: #5f584f;
}

.task-search-result-card button {
  justify-self: start;
  min-height: 34px;
  margin-top: 3px;
  padding: 5px 9px;
  border: 1px solid #b9a989;
  border-radius: 9px;
  background: #fff;
  font-weight: 750;
}

@media (max-width: 700px) {
  .note-reminder-editor {
    align-items: stretch;
  }

  .note-reminder-field {
    flex: 1 1 140px;
  }

  .note-reminder-field input,
  #clearReminderButton {
    min-height: 40px;
  }
}

/* =========================================================
   Encrypted Drawings workspace
   ========================================================= */

.drawing-workspace-button {
  white-space: nowrap;
  width: auto !important;
  min-width: 0 !important;
  min-height: 34px !important;
  height: 34px !important;
  padding: 4px 9px !important;
  border-radius: 9px !important;
  font-size: 14px !important;
  line-height: 1 !important;
  font-weight: 800;
}

body.rnc-drawing-workspace-open {
  overflow: hidden;
}

.rnc-drawing-workspace,
.rnc-drawing-editor {
  position: fixed;
  inset: 0;
  z-index: 49000;
  color: #302d29;
  font-family: inherit;
}

.rnc-drawing-workspace.hidden {
  display: none;
}

.rnc-drawing-workspace {
  background: #f7f2e8;
}

.rnc-drawing-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.rnc-drawing-header,
.rnc-drawing-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #d8cdbd;
  background: #fffdf9;
}

.rnc-drawing-header h2,
.rnc-drawing-header p {
  margin: 0;
}

.rnc-drawing-header h2 {
  color: #5f4421;
  font-size: clamp(1.15rem, 1.7vw, 1.55rem);
}

.rnc-drawing-header p {
  margin-top: 2px;
  color: #716a61;
  font-size: 12px;
}

.rnc-drawing-header-actions,
.rnc-drawing-editor-header > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.rnc-drawing-workspace button,
.rnc-drawing-workspace input,
.rnc-drawing-workspace select,
.rnc-drawing-editor button,
.rnc-drawing-editor input,
.rnc-drawing-editor select {
  box-sizing: border-box;
  min-height: 34px;
  border: 1px solid #cfc3b3;
  border-radius: 9px;
  background: #fffdf9;
  color: #332f2a;
  padding: 5px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
}

.rnc-drawing-workspace button,
.rnc-drawing-editor button {
  cursor: pointer;
}

.rnc-drawing-close {
  width: 38px;
  padding: 0 !important;
  font-size: 20px !important;
}

.rnc-drawing-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(210px, 320px);
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid #ded4c5;
  background: #f1e8da;
}

.rnc-drawing-main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.rnc-drawing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.rnc-drawing-card {
  overflow: hidden;
  border: 1px solid #d8cdbd;
  border-radius: 13px;
  background: #fffdf9;
  box-shadow: 0 2px 8px rgba(63, 45, 25, 0.08);
  cursor: pointer;
}

.rnc-drawing-card canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  border-bottom: 1px solid #ded4c5;
  background: #fff;
}

.rnc-drawing-card-copy {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
}

.rnc-drawing-card-copy span {
  color: #716a61;
  font-size: 11px;
}

.rnc-drawing-empty {
  grid-column: 1 / -1;
  padding: 42px 20px;
  border: 1px dashed #c7b8a4;
  border-radius: 12px;
  text-align: center;
}

.rnc-drawing-empty p {
  margin: 6px 0 0;
  color: #716a61;
}

.rnc-drawing-editor {
  z-index: 51000;
  display: grid;
  place-items: center;
  padding: 10px;
  background: rgba(44, 40, 34, 0.72);
}

.rnc-drawing-editor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(1180px, 100%);
  height: min(800px, calc(100dvh - 20px));
  min-height: 0;
  overflow: hidden;
  border: 2px solid #a97a2d;
  border-radius: 16px;
  background: #fffdf9;
  box-shadow: 0 22px 70px rgba(34, 28, 20, 0.35);
}

.rnc-drawing-editor-header {
  grid-column: 1 / -1;
  padding: 8px 10px;
}

.rnc-drawing-title-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.rnc-drawing-title-wrap > strong {
  overflow: hidden;
  min-width: 0;
  max-width: min(520px, 65vw);
  color: #2f2c29;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rnc-drawing-title-wrap > button {
  flex: 0 0 auto;
}

.rnc-drawing-editor-header [data-editor-action="cancel"] {
  width: 34px;
  padding: 0;
  font-size: 20px;
}

.rnc-drawing-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 10px;
  border-bottom: 1px solid #d8cdbd;
  background: #f8f3e9;
}

.rnc-drawing-toolbar button.active {
  border-color: #76562a;
  background: #8b795f;
  color: white;
}

.rnc-drawing-toolbar .danger-button {
  margin-left: auto;
}

.rnc-drawing-colors {
  display: flex;
  gap: 4px;
}

.rnc-drawing-colors button {
  width: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 50%;
  background: var(--drawing-color);
}

.rnc-drawing-colors button.active {
  outline: 3px solid rgba(139, 111, 71, 0.35);
  outline-offset: 1px;
}

.rnc-drawing-finger-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 6px;
  font-size: 12px;
  white-space: nowrap;
}

.rnc-drawing-finger-toggle input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
}

.rnc-drawing-stage {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 10px;
  background: #ded7cb;
}

.rnc-drawing-stage canvas {
  display: block;
  width: 100%;
  max-width: 1200px;
  height: auto;
  aspect-ratio: 3 / 2;
  margin: 0 auto;
  background: #fffdf9;
  box-shadow: 0 2px 10px rgba(42, 34, 24, 0.16);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}

.rnc-drawing-links {
  min-height: 0;
  overflow: auto;
  padding: 8px;
  border-left: 1px solid #d8cdbd;
  background: #f7f2e8;
}

.rnc-drawing-location-fields {
  display: grid;
  gap: 7px;
  margin-bottom: 8px;
}

.rnc-drawing-location-fields label {
  display: grid;
  gap: 3px;
  color: #5f5549;
  font-size: 11px;
  font-weight: 800;
}

.rnc-drawing-links details {
  margin-bottom: 7px;
  border: 1px solid #d6cab8;
  border-radius: 9px;
  background: #fffdf9;
}

.rnc-drawing-links summary {
  padding: 8px;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.rnc-drawing-links summary span {
  float: right;
}

.rnc-drawing-choice-list {
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow: auto;
  padding: 0 7px 7px;
}

.rnc-drawing-choice-list label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 11px;
}

.rnc-drawing-choice-list input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
}

.rnc-drawing-choice-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rnc-drawing-choice-list small {
  display: block;
  color: #716a61;
}

.rnc-drawing-choice-empty {
  margin: 0;
  padding: 6px;
  color: #716a61;
  font-size: 11px;
}

.rnc-drawing-editor-shell > footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 7px 10px;
  border-top: 1px solid #d8cdbd;
  background: #fffdf9;
}

.rnc-drawing-editor-shell > footer span {
  margin-right: auto;
  color: #27613a;
  font-size: 11px;
  font-weight: 750;
}

@media (min-width: 1100px) {
  .topbar > .top-controls {
    grid-template-columns:
      minmax(72px, .56fr) minmax(72px, .56fr) minmax(72px, .56fr)
      minmax(145px, 1.2fr) minmax(145px, 1.12fr)
      minmax(88px, .68fr) minmax(84px, .64fr) minmax(98px, .76fr)
      minmax(174px, 1.3fr) !important;
    grid-template-areas:
      "menu lists note cabinet search tags manage sort view" !important;
  }
}

@media (min-width: 701px) and (max-width: 1099px) {
  .topbar > .top-controls {
    grid-template-areas:
      "menu menu lists lists note note search search search search search search"
      "cabinet cabinet cabinet tags tags manage manage sort sort view view view" !important;
  }
}

.top-controls > .drawing-workspace-button {
  grid-area: drawings !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
}

@media (min-width: 701px) {
  .top-controls > .drawing-workspace-button {
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 8px !important;
    border-radius: 10px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 800px) {
  .rnc-drawing-editor {
    padding: 0;
  }

  .rnc-drawing-editor-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(280px, 1fr) auto auto;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-width: 0;
    border-radius: 0;
  }

  .rnc-drawing-links {
    max-height: 190px;
    border-top: 1px solid #d8cdbd;
    border-left: 0;
  }

  .rnc-drawing-stage {
    padding: 6px;
  }
}

@media (max-width: 700px) {
  .rnc-drawing-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .rnc-drawing-grid {
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 8px;
  }

  .rnc-drawing-toolbar {
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .rnc-drawing-toolbar > * {
    flex: 0 0 auto;
  }

  .rnc-drawing-title-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }

  .rnc-drawing-editor-shell {
    width: 100vw;
    max-width: 100vw;
    min-width: 0;
  }

  .rnc-drawing-editor-header,
  .rnc-drawing-stage,
  .rnc-drawing-links,
  .rnc-drawing-editor-shell > footer {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100vw;
  }

  .rnc-drawing-editor-header > div,
  .rnc-drawing-editor-shell > footer > button {
    flex: 0 0 auto;
  }

  .rnc-drawing-editor-shell > footer span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rnc-drawing-location-fields select {
    width: 100%;
    min-width: 0;
  }
}

/* 0.3.7C - Reminder notifications */

.notification-button {
  white-space: nowrap;
  min-height: 40px;
}

.notification-button:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (max-width: 700px) {
  .notification-button {
    width: 100%;
  }
}

/* 0.3.7C - compact notification control */

.notification-button {
  width: auto;
  min-width: 0;
  min-height: 40px;
  padding-left: 14px;
  padding-right: 14px;
}

/* 0.3.7C - In-app due reminder popup */

.rnc-reminder-popup {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.22);
}

.rnc-reminder-popup-panel {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 18px;
  background: #f7f1e5;
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.22);
}

.rnc-reminder-popup-label {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.62;
}

.rnc-reminder-popup-panel h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

.rnc-reminder-popup-due {
  margin-bottom: 20px;
  font-size: 14px;
  opacity: 0.72;
}

.rnc-reminder-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 700px) {
  .rnc-reminder-popup {
    align-items: flex-end;
    padding: 12px;
  }

  .rnc-reminder-popup-panel {
    border-radius: 18px;
  }

  .rnc-reminder-popup-actions button {
    min-height: 44px;
  }
}

/* 0.3.8A - Note icons */

.note-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.note-title-row .note-title-input {
  flex: 1;
  min-width: 0;
}

.note-icon-select {
  width: 58px;
  min-width: 58px;
  height: 40px;
  border-radius: 8px;
  font-size: 20px;
  text-align: center;
}

.note-title-icon {
  display: inline-block;
  margin-right: 7px;
  font-size: 0.95em;
  line-height: 1;
}

@media (max-width: 700px) {
  .note-icon-select {
    width: 54px;
    min-width: 54px;
  }
}

/* 0.3.8A - compact icon selector */

.note-icon-select {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  padding-left: 6px;
  padding-right: 4px;
}

.mobile-note-location-control {
  display: none;
}

/* 0.3.8A - streamlined note editor */

.note-meta-strip {
  display: grid;
  grid-template-columns:
    minmax(190px, 0.9fr)
    minmax(220px, 1.2fr)
    minmax(300px, 1.1fr);
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}

.note-meta-item {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
}

.note-meta-item label,
.note-meta-label {
  display: block;
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.66;
}

.note-notebook-editor,
.note-tags-editor,
.note-reminder-editor {
  display: block;
}

.note-notebook-editor select,
.note-tags-editor input {
  width: 100%;
  min-height: 36px;
  box-sizing: border-box;
  margin: 0;
}

.note-reminder-controls {
  display: grid;
  grid-template-columns:
    minmax(130px, 1fr)
    minmax(105px, 0.8fr)
    auto;
  gap: 6px;
  align-items: center;
}

.note-reminder-controls input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  box-sizing: border-box;
  padding: 5px 8px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
}

.compact-reminder-clear {
  min-height: 36px;
  padding: 6px 10px;
  white-space: nowrap;
}

.document-editor {
  flex: 1 1 auto;
}

.composer-footer {
  gap: 10px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.composer-footer .color-picker {
  flex-shrink: 0;
}

.composer-footer .date-toggle {
  white-space: nowrap;
}

.composer-actions {
  margin-left: auto;
}

@media (max-width: 950px) {
  .note-meta-strip {
    grid-template-columns:
      minmax(180px, 1fr)
      minmax(220px, 1.3fr);
  }

  .note-reminder-editor {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .note-meta-strip {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .note-reminder-editor {
    grid-column: auto;
  }

  .note-reminder-controls {
    grid-template-columns: 1fr 1fr;
  }

  .compact-reminder-clear {
    grid-column: 1 / -1;
  }

  .composer-footer {
    flex-wrap: wrap;
  }

  .composer-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
}

/* 0.3.8A - streamlined editor polish */

/* Make Tags clearly editable without turning it back into a heavy box */
.note-tags-editor input {
  min-height: 36px;
  padding: 5px 9px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.34);
  outline: none;
}

.note-tags-editor input:focus {
  border-color: rgba(0, 0, 0, 0.28);
  background: rgba(255, 255, 255, 0.55);
}

/* Give the reminder time enough room for AM / PM */
.note-reminder-controls {
  grid-template-columns:
    minmax(150px, 1.05fr)
    minmax(130px, 0.9fr)
    auto;
}

#noteReminderTime {
  min-width: 130px;
}

/* Keep save state visible but secondary */
.save-status {
  max-width: 92px;
  font-size: 11px;
  line-height: 1.15;
  opacity: 0.62;
}

/* Preserve compact footer rhythm */
.composer-footer {
  align-items: center;
}

@media (max-width: 700px) {
  .note-reminder-controls {
    grid-template-columns: 1fr 1fr;
  }

  #noteReminderTime {
    min-width: 0;
  }

  .save-status {
    max-width: none;
    font-size: 10px;
  }
}

/* 0.3.8A - footer overflow fix */

.composer-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.composer-footer .color-picker,
.composer-footer .date-toggle,
.composer-footer .save-status {
  flex-shrink: 0;
}

.composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
  justify-content: flex-end;
}

@media (max-width: 1050px) {
  .composer-actions {
    flex-basis: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
}

@media (max-width: 700px) {
  .composer-actions {
    justify-content: stretch;
  }

  .composer-actions button {
    flex: 1 1 auto;
  }
}

/* 0.3.8A - final metadata fit polish */

.note-reminder-editor {
  min-width: 0;
}

.note-reminder-controls {
  width: 100%;
  min-width: 0;
  grid-template-columns:
    minmax(145px, 1fr)
    minmax(120px, 0.8fr)
    auto;
}

#noteReminderDate,
#noteReminderTime {
  min-width: 0;
}

.compact-reminder-clear {
  min-width: 58px;
  padding-left: 9px;
  padding-right: 9px;
}

/* Keep save/open status from consuming footer space */
.save-status {
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 0.3.8A - compact lower editor controls */

.note-meta-strip {
  gap: 8px;
}

.note-meta-item label,
.note-meta-label {
  font-size: 10px;
  margin-bottom: 3px;
}

.note-notebook-editor select,
.note-tags-editor input,
.note-reminder-controls input {
  min-height: 32px;
  height: 32px;
  font-size: 13px;
  padding: 3px 8px;
}

.note-reminder-controls {
  grid-template-columns:
    minmax(130px, 1fr)
    minmax(110px, 0.8fr)
    auto;
  gap: 5px;
}

.compact-reminder-clear {
  min-height: 32px;
  height: 32px;
  min-width: 50px;
  padding: 3px 8px;
  font-size: 12px;
}

.composer-footer {
  gap: 8px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.composer-footer .date-toggle {
  font-size: 12px;
}

.save-status {
  font-size: 9px;
  max-width: 62px;
}

.composer-actions {
  gap: 6px;
}

.composer-actions button {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 13px;
}

.color-picker {
  gap: 5px;
}

@media (max-width: 700px) {
  .note-notebook-editor select,
  .note-tags-editor input,
  .note-reminder-controls input,
  .compact-reminder-clear {
    min-height: 36px;
    height: 36px;
  }

  .composer-actions button {
    min-height: 38px;
  }
}

/* 0.3.8C - Notebook colors */

.manage-notebook-info {
  position: relative;
}

.notebook-color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  min-width: 10px;
  margin-right: 7px;
  border-radius: 50%;
  vertical-align: middle;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.14);
}

/* 0.3.8C - active notebook color identity */

#viewHeading.notebook-accent-heading {
  padding-left: 10px;
  border-left:
    4px solid
    var(--notebook-accent);
}

/* 0.3.9A - Freeform canvas */

.notes-grid.freeform-view {
  position: relative;
  display: block;
  min-height: 820px;
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(
      circle,
      rgba(90, 78, 62, 0.10) 1px,
      transparent 1px
    );
  background-size: 24px 24px;
}

.notes-grid.freeform-view .note-card {
  position: absolute;
  width: 230px;
  min-height: 95px;
  max-height: 260px;
  margin: 0;
}

.notes-grid.freeform-view .drag-handle {
  cursor: move;
}

@media (max-width: 700px) {
  .notes-grid.freeform-view {
    min-height: 680px;
  }

  .notes-grid.freeform-view .note-card {
    width: min(220px, calc(100% - 16px));
  }
}

/* 0.3.9B - Expandable Freeform workspace */

.notes-grid.freeform-view {
  position: relative;
  display: block;
  width: 100%;
  height: 720px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(120, 110, 98, 0.12);
  border-radius: 14px;
  background:
    radial-gradient(
      circle,
      rgba(90, 78, 62, 0.10) 1px,
      transparent 1px
    );
  background-size: 24px 24px;
}

/*
  Invisible normal-flow spacer creates the
  scrollable canvas underneath absolute cards.
*/
.notes-grid.freeform-view::after {
  content: "";
  display: block;
  width:
    var(
      --freeform-canvas-width,
      1600px
    );
  height:
    var(
      --freeform-canvas-height,
      1100px
    );
  pointer-events: none;
}

.notes-grid.freeform-view .note-card {
  z-index: 1;
}

@media (max-width: 700px) {
  .notes-grid.freeform-view {
    height: 620px;
  }

  .notes-grid.freeform-view::after {
    width:
      var(
        --freeform-canvas-width,
        1200px
      );
    height:
      var(
        --freeform-canvas-height,
        900px
      );
  }
}

/* 0.3.9C1 - Freeform zoom */

.freeform-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 3px;
}

.freeform-zoom-controls.hidden {
  display: none;
}

.freeform-zoom-controls button {
  min-width: 28px;
  height: 28px;
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1;
}

#freeformZoomResetButton {
  min-width: 44px;
}

.notes-grid.freeform-view .note-card {
  transform:
    scale(
      var(--freeform-zoom, 1)
    );
  transform-origin: top left;
}

/* Preserve the zoom while hovering a Freeform card */
.notes-grid.freeform-view .note-card:hover {
  transform:
    scale(
      var(--freeform-zoom, 1)
    );
}

@media (max-width: 700px) {
  .freeform-zoom-controls button {
    min-width: 30px;
    height: 30px;
  }
}

/* 0.3.9C2 - Freeform pan */

.notes-grid.freeform-view {
  cursor: grab;
  touch-action: none;
}

.notes-grid.freeform-view.freeform-panning {
  cursor: grabbing;
  user-select: none;
}

.notes-grid.freeform-view .note-card {
  cursor: default;
}

.notes-grid.freeform-view .drag-handle {
  cursor: move;
}

/* 0.3.9C2 - Freeform drag repair */

.notes-grid.freeform-view .drag-handle {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.notes-grid.freeform-view .note-card {
  -webkit-user-drag: none;
}

/* 0.3.9C3 - Freeform Home / Fit */

#freeformHomeButton {
  min-width: 30px;
}

#freeformFitButton {
  min-width: 34px;
  font-size: 10px;
}

/* 0.3.9D1 - Pinning is not a Freeform concept */

.notes-grid.freeform-view .pin-action {
  display: none;
}

/* 0.3.9D2 - Floating Freeform toolbar */

.freeform-board-shell {
  position: relative;
}

.freeform-board-shell .freeform-zoom-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 25;

  display: inline-flex;
  align-items: center;
  gap: 3px;

  margin: 0;
  padding: 5px;

  background:
    rgba(250, 247, 240, 0.94);

  border:
    1px solid
    rgba(120, 110, 98, 0.18);

  border-radius: 10px;

  box-shadow:
    0 4px 14px
    rgba(60, 52, 43, 0.10);

  backdrop-filter:
    blur(8px);

  -webkit-backdrop-filter:
    blur(8px);
}

.freeform-board-shell
.freeform-zoom-controls.hidden {
  display: none;
}

.freeform-board-shell
.freeform-zoom-controls button {
  min-width: 28px;
  height: 28px;
  padding: 2px 6px;
}

.freeform-board-shell
#freeformZoomResetButton {
  min-width: 44px;
}

.freeform-board-shell
#freeformFitButton {
  min-width: 34px;
}

@media (max-width: 700px) {
  .freeform-board-shell
  .freeform-zoom-controls {
    top: 8px;
    right: 8px;
    padding: 4px;
  }
}

/* 0.3.9D2A - Freeform toolbar above canvas */

/*
  Keep the Freeform canvas as one complete visible box.
  The toolbar sits above it instead of floating over it.
*/
.freeform-board-shell {
  position: relative;
}

/* Override the previous floating placement */
.freeform-board-shell .freeform-zoom-controls {
  position: static;

  display: flex;
  width: max-content;

  margin:
    0
    0
    10px
    auto;

  padding: 5px;

  background:
    rgba(250, 247, 240, 0.94);

  border:
    1px solid
    rgba(120, 110, 98, 0.18);

  border-radius: 10px;

  box-shadow:
    0 3px 10px
    rgba(60, 52, 43, 0.08);

  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/*
  Restore/guarantee the complete Freeform canvas outline,
  including the bottom edge.
*/
.freeform-board-shell
.notes-grid.freeform-view {
  box-sizing: border-box;

  border:
    1px solid
    rgba(120, 110, 98, 0.12);

  border-radius: 14px;
}

/* Keep hidden behavior intact outside Freeform */
.freeform-board-shell
.freeform-zoom-controls.hidden {
  display: none;
}

@media (max-width: 700px) {
  .freeform-board-shell
  .freeform-zoom-controls {
    margin-bottom: 8px;
  }
}

/* 0.3.9D2B - Keep complete Freeform canvas visible */

.notes-grid.freeform-view {
  height:
    calc(
      100dvh - 355px
    );

  min-height: 420px;
  max-height: 720px;
}

@media (max-width: 700px) {
  .notes-grid.freeform-view {
    height:
      calc(
        100dvh - 320px
      );

    min-height: 360px;
    max-height: 620px;
  }
}

/* 0.3.9E - Freeform marquee selection */

.notes-grid.freeform-view
.freeform-marquee {
  position: absolute;
  z-index: 20;

  pointer-events: none;

  border:
    1.5px solid
    rgba(0, 87, 255, 0.72);

  border-radius: 5px;

  background:
    rgba(0, 87, 255, 0.09);

  box-shadow:
    inset 0 0 0 1px
    rgba(255, 255, 255, 0.35);
}

.notes-grid.freeform-view
.freeform-marquee-active {
  cursor: crosshair;
}

/* 0.3.9E1 - Pull Freeform workspace upward */

#allNotesSection:has(#notesGrid.freeform-view) {
  margin-top: -58px;
}

@media (max-width: 700px) {
  #allNotesSection:has(#notesGrid.freeform-view) {
    margin-top: -28px;
  }
}

/* 0.3.9E2 - Align Freeform heading and toolbar */

#allNotesSection:has(#notesGrid.freeform-view) {
  position: relative;
}

/*
  Let the toolbar position relative to the complete
  Notes section instead of relative to the canvas shell.
*/
#allNotesSection:has(#notesGrid.freeform-view)
.freeform-board-shell {
  position: static;
}

/*
  Reserve enough space on the right so the heading
  and toolbar never collide.
*/
#allNotesSection:has(#notesGrid.freeform-view)
.section-heading {
  min-height: 38px;
  margin-bottom: 10px;
  padding-right: 245px;
}

/*
  Put the Freeform controls on the same visual row
  as the Notes heading.
*/
#allNotesSection:has(#notesGrid.freeform-view)
.freeform-zoom-controls {
  position: absolute;
  top: 0;
  right: 0;

  margin: 0;
}

/* Restore normal shell positioning outside Freeform */
#allNotesSection:not(:has(#notesGrid.freeform-view))
.freeform-board-shell {
  position: relative;
}

@media (max-width: 700px) {
  #allNotesSection:has(#notesGrid.freeform-view)
  .section-heading {
    padding-right: 0;
    margin-bottom: 8px;
  }

  #allNotesSection:has(#notesGrid.freeform-view)
  .freeform-board-shell {
    position: relative;
  }

  #allNotesSection:has(#notesGrid.freeform-view)
  .freeform-zoom-controls {
    position: static;
    margin:
      0
      0
      8px
      auto;
  }
}

/* 0.3.9E3 - Responsive Freeform height */

/*
  JavaScript now calculates the actual available
  browser height. Do not cap the desktop canvas
  at the old fixed 720px value.
*/
.notes-grid.freeform-view {
  max-height: none;
}

@media (max-width: 700px) {
  .notes-grid.freeform-view {
    max-height: none;
  }
}

/* 0.3.10A - Freeform card resizing */

.freeform-resize-handle {
  display: none;
}

.notes-grid.freeform-view .note-card {
  max-height: none;
}

.notes-grid.freeform-view
.freeform-resize-handle {
  position: absolute;

  right: 3px;
  bottom: 3px;

  z-index: 8;

  display: block;

  width: 18px;
  height: 18px;

  padding: 0;
  border: 0;

  background: transparent;

  cursor: nwse-resize;

  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.notes-grid.freeform-view
.freeform-resize-handle::after {
  content: "";

  position: absolute;

  right: 2px;
  bottom: 2px;

  width: 9px;
  height: 9px;

  border-right:
    2px solid
    rgba(90, 78, 62, 0.48);

  border-bottom:
    2px solid
    rgba(90, 78, 62, 0.48);
}

.notes-grid.freeform-view
.note-card:hover
.freeform-resize-handle::after,
.notes-grid.freeform-view
.note-card.freeform-resizing
.freeform-resize-handle::after {
  border-color:
    rgba(70, 60, 48, 0.8);
}

.notes-grid.freeform-view
.note-card.freeform-resizing {
  user-select: none;
}

/* 0.3.10B - Freeform Arrange */

.freeform-arrange-wrap {
  position: relative;
  display: inline-flex;
}

.freeform-arrange-menu {
  position: absolute;

  top: calc(100% + 6px);
  right: 0;

  z-index: 40;

  min-width: 130px;
  padding: 5px;

  border:
    1px solid
    rgba(120, 110, 98, 0.20);

  border-radius: 9px;

  background:
    rgba(250, 247, 240, 0.98);

  box-shadow:
    0 8px 22px
    rgba(60, 52, 43, 0.14);
}

.freeform-arrange-menu.hidden {
  display: none;
}

.freeform-arrange-menu button {
  display: block;

  width: 100%;
  min-width: 0;
  height: auto;

  padding: 7px 9px;

  border: 0;
  border-radius: 6px;

  background: transparent;

  text-align: left;
  white-space: nowrap;
}

.freeform-arrange-menu button:hover {
  background:
    rgba(120, 110, 98, 0.10);
}

/* 0.3.10C - Grid density: Spread Out */

.notes-grid.grid-spread-view {
  grid-template-columns:
    repeat(
      auto-fill,
      minmax(285px, 1fr)
    );

  column-gap: 24px;
  row-gap: 24px;
}

@media (max-width: 700px) {
  .notes-grid.grid-spread-view {
    grid-template-columns:
      repeat(
        auto-fill,
        minmax(205px, 1fr)
      );

    column-gap: 16px;
    row-gap: 18px;
  }
}

/* RNC compact File menu */
.file-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.file-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: auto;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(116, 95, 68, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.file-menu-button-label {
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.file-menu-button:hover {
  background: rgba(255, 255, 255, 0.95);
}

.file-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1000;
  min-width: 310px;
  padding: 6px;
  border: 1px solid rgba(116, 95, 68, 0.22);
  border-radius: 10px;
  background: #fffdf8;
  box-shadow: 0 8px 24px rgba(60, 48, 33, 0.14);
}

.file-menu-heading {
  padding: 7px 11px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.file-menu-dropdown.hidden {
  display: none;
}

.file-menu-dropdown button {
  display: block;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.file-menu-dropdown button:hover {
  background: rgba(116, 95, 68, 0.09);
}

/* Notes export */
.export-notes-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 18px;
}

.export-notes-modal.hidden {
  display: none;
}

html:has(body.rnc-transfer-dialog-open),
body.rnc-transfer-dialog-open {
  overflow: hidden;
}

.rnc-transfer-password-modal {
  position: fixed;
  z-index: 50000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
}

.rnc-transfer-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(47, 43, 37, .52);
}

.rnc-transfer-password-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(520px, 100%);
  max-height: calc(100dvh - 32px);
  padding: 22px;
  overflow-y: auto;
  border: 2px solid #a9701d;
  border-radius: 18px;
  background: var(--panel-bg);
  box-shadow: 0 20px 55px rgba(45, 38, 30, .32);
}

.rnc-transfer-password-panel h2,
.rnc-transfer-password-panel p {
  margin: 0;
}

.rnc-transfer-password-panel label:not(.rnc-transfer-show-password) {
  display: grid;
  gap: 6px;
  font-weight: 750;
}

.rnc-transfer-password-panel input[type="password"],
.rnc-transfer-password-panel input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: white;
}

.rnc-transfer-show-password {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rnc-transfer-password-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.export-notes-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(36, 31, 26, 0.54);
}

.export-notes-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: min(680px, calc(100dvh - 36px));
  overflow-y: auto;
  padding: 22px;
  border: 1px solid rgba(116, 95, 68, 0.22);
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: 0 22px 60px rgba(35, 29, 23, 0.28);
}

.export-notes-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.export-notes-heading h2 {
  margin: 0;
  font-size: 22px;
}

.export-notes-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.export-notes-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  color: var(--text);
  font-size: 25px;
  line-height: 1;
}

.export-notes-scope {
  display: grid;
  gap: 6px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.export-notes-scope select {
  width: 100%;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
}

.export-notes-count {
  min-height: 18px;
  margin: 7px 0 13px;
  color: var(--muted);
  font-size: 12px;
}

.export-notes-actions {
  display: grid;
  gap: 10px;
}

.export-notes-actions button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 62px;
  padding: 11px 14px;
  text-align: left;
}

.export-notes-actions button strong {
  font-size: 15px;
}

.export-notes-actions button span {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.86;
}

.export-notes-privacy {
  margin: 15px 0 0;
  padding: 11px 12px;
  border-radius: 9px;
  background: rgba(116, 95, 68, 0.07);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.export-notes-status {
  min-height: 19px;
  margin: 10px 0 0;
  color: #245f3b;
  font-size: 12px;
  font-weight: 650;
}

.export-notes-status.error {
  color: #84372d;
}

body.export-notes-open {
  overflow: hidden;
}

.rnc-print-frame {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 700px) {
  .export-notes-modal {
    align-items: end;
    padding: 0;
  }

  .export-notes-panel {
    width: 100%;
    max-height: calc(100dvh - 18px);
    padding: 18px 16px max(18px, env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }
}

.working-rnc-file-status {
  margin: 5px 6px;
  padding: 9px 10px;
  border: 1px solid rgba(116, 95, 68, 0.14);
  border-radius: 8px;
  background: rgba(116, 95, 68, 0.045);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.working-rnc-file-status > div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 5px;
  align-items: start;
}

.working-rnc-file-status strong {
  color: var(--text);
  font-weight: 650;
}

.working-rnc-file-status span {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Compact reminder notification button */
.compact-notification-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
}

/* Nested list styles */
.document-editor ul,
.card-preview ul {
  list-style-type: disc;
}

.document-editor ul ul,
.card-preview ul ul {
  list-style-type: circle;
}

.document-editor ul ul ul,
.card-preview ul ul ul {
  list-style-type: square;
}

.document-editor ol,
.card-preview ol {
  list-style-type: decimal;
}

.document-editor ol ol,
.card-preview ol ol {
  list-style-type: lower-alpha;
}

.document-editor ol ol ol,
.card-preview ol ol ol {
  list-style-type: lower-roman;
}

/* RTC-style Undo / Redo icons */
.format-toolbar .rtc-history-button {
  width: 32px;
  min-width: 32px;
  padding: 4px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.format-toolbar .rtc-history-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* RTC-style Undo / Redo icons */
.format-toolbar .rtc-history-button {
  width: 32px;
  min-width: 32px;
  padding: 4px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.format-toolbar .rtc-history-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* Final Undo / Redo visual treatment */
.format-toolbar #undoButton.rtc-history-button,
.format-toolbar #redoButton.rtc-history-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 4px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.format-toolbar #undoButton.rtc-history-button svg,
.format-toolbar #redoButton.rtc-history-button svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* Material-style Undo / Redo artwork */
.format-toolbar #undoButton.rtc-history-button svg,
.format-toolbar #redoButton.rtc-history-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor !important;
  stroke: none !important;
}

/* Standard Undo / Redo icons */
.format-toolbar #undoButton.rtc-history-button svg,
.format-toolbar #redoButton.rtc-history-button svg {
  width: 20px;
  height: 20px;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Clear Tags input treatment */
.note-tags-editor {
  padding: 0;
  border: 0;
  background: transparent;
  align-items: flex-start;
  gap: 6px;
}

.note-tags-editor label {
  margin-top: 7px;
}

#noteTagsInput {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.72);
}

#noteTagsInput:focus {
  border-color: var(--accent-dark);
  outline: 2px solid rgba(120,110,98,.12);
}

#noteTagsInput::placeholder {
  opacity: .75;
}

/* Compact note symbol / icon selector */
.note-icon-select {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  height: 32px;
  padding: 3px 4px;
  border-radius: 8px;
  font-size: 15px;
  text-align: center;
}

/* Active rich-text toolbar controls */
.format-toolbar button.is-active {
  background: #e9e9e7;
  border-color: #d8d6d1;
}

/* RNC About screen */
.file-menu-divider {
  height: 1px;
  margin: 5px 8px;
  background: var(--border);
}

.file-menu-update-status {
  margin: 3px 11px 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.file-menu-update-status:empty {
  display: none;
}

.about-rnc-modal {
  position: fixed;
  inset: 0;
  z-index: 31000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.about-rnc-modal.hidden {
  display: none;
}

.about-rnc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 31, 27, .42);
}

.about-rnc-panel {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 30px 30px 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-bg);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .22);
  text-align: left;
}

.about-rnc-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}

.about-rnc-close:hover {
  background: rgba(120, 110, 98, .10);
  color: var(--text);
}

.about-rnc-brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  margin: 0;
  border-radius: 13px;
  background: #765f48;
  color: white;
  font-size: 32px;
  font-weight: 700;
}

.about-rnc-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 36px;
}

.about-rnc-panel h2 {
  margin: 0;
  font-size: 24px;
}

.about-rnc-product {
  margin: 5px 0 0;
  color: var(--text);
  font-weight: 700;
}

.about-rnc-creator {
  margin: 4px 0 2px;
  color: var(--muted);
}

.about-rnc-version {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.about-rnc-description {
  max-width: 680px;
  margin: 20px 0 22px;
  line-height: 1.55;
}

.about-rnc-quick-help {
  display: grid;
  gap: 9px;
  margin: 0 0 20px;
  padding: 13px 14px;
  border: 1px solid rgba(120, 110, 98, .16);
  border-radius: 12px;
  background: rgba(118, 95, 72, .06);
}

.about-rnc-quick-help strong {
  font-size: 13px;
}

.about-rnc-quick-help div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.about-rnc-quick-help button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, .72);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.about-rnc-quick-help button:hover {
  background: white;
}

.about-rnc-section[id] {
  scroll-margin-top: 12px;
}

.about-rnc-section {
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid rgba(120, 110, 98, .16);
  border-radius: 12px;
  background: rgba(255, 255, 255, .42);
  text-align: left;
}

.about-rnc-section h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.about-rnc-section p {
  margin: 0 0 10px;
  line-height: 1.5;
  color: var(--muted);
}

.about-rnc-section p:last-child {
  margin-bottom: 0;
}

.about-rnc-section ol {
  margin: 8px 0 12px;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.about-rnc-section ul {
  margin: 8px 0 12px;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.about-rnc-plain-callout {
  padding: 10px 12px;
  border-left: 4px solid #9a7442;
  border-radius: 8px;
  background: #fff3c8;
  color: var(--text) !important;
}

.about-rnc-section li + li {
  margin-top: 5px;
}

.about-rnc-section code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(116, 95, 68, .09);
  color: var(--text);
  font-size: .92em;
}

.rnc-sync-diagnostics-controls,
.rnc-sync-diagnostics-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 8px;
}

.rnc-sync-diagnostics-controls button,
.rnc-sync-diagnostics-actions button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-bg);
  color: var(--text);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.rnc-sync-diagnostics-note {
  font-size: 12px;
}

.rnc-sync-diagnostics-modal {
  position: fixed;
  inset: 0;
  z-index: 34000;
  display: grid;
  place-items: center;
  padding: 18px;
}

.rnc-sync-diagnostics-modal.hidden {
  display: none;
}

.rnc-sync-diagnostics-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 31, 27, .48);
}

.rnc-sync-diagnostics-panel {
  position: relative;
  z-index: 1;
  width: min(820px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-bg);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .24);
}

.rnc-sync-diagnostics-panel h2 {
  margin: 0 40px 6px 0;
}

.rnc-sync-diagnostics-panel > p {
  color: var(--muted);
}

.rnc-sync-diagnostics-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-bg);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

#rncSyncDiagnosticsOutput {
  box-sizing: border-box;
  width: 100%;
  min-height: 280px;
  max-height: 52vh;
  overflow: auto;
  margin: 14px 0 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(116, 95, 68, .06);
  color: var(--text);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.rnc-sync-diagnostics-status {
  min-height: 20px;
  margin: 6px 0 !important;
  color: #216238 !important;
  font-weight: 700;
}

@media (max-width: 600px) {
  .rnc-sync-diagnostics-panel {
    padding: 20px 14px 16px;
  }

  #rncSyncDiagnosticsOutput {
    min-height: 220px;
    max-height: 48vh;
    font-size: 11px;
  }

  .rnc-sync-diagnostics-actions button {
    flex: 1 1 130px;
  }
}

.about-rnc-tagline {
  margin: 20px 0 8px;
  font-weight: 650;
  text-align: center;
}

.about-rnc-link {
  display: block;
  color: var(--text);
  text-align: center;
}

.about-rnc-copyright {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.about-rnc-footer-close {
  display: block;
  margin: 22px auto 0;
}

/* RNC update controls */
.about-rnc-update {
  margin: 10px 0 18px;
}

.about-rnc-update button {
  margin: 3px;
}

.about-rnc-update-status {
  min-height: 18px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* =========================================================
   RNC Smartphone Layout - Mobile Pass 1
   Desktop/tablet remain unchanged.
   ========================================================= */

@media (max-width: 700px) {

  body {
    padding-bottom: 86px;
  }

  /* Compact sticky header */
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    padding: 9px 10px 10px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 20px;
  }

  .brand h1 {
    font-size: 17px;
    line-height: 1.15;
  }

  .creator {
    margin-top: 1px;
    font-size: 10px;
  }

  /* Phone controls */
  .top-controls {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  /*
    Search is the primary phone control.
    Put it on its own row ahead of filters.
  */
  .top-field-search {
    order: -20;
    width: 100%;
  }

  .top-field-search .top-field-label {
    display: none;
  }

  .search-input {
    width: 100%;
    height: 40px;
    padding: 9px 12px;
    border-radius: 12px;
  }

  /* Secondary header controls become compact */
  .top-field {
    min-width: 0;
  }

  .top-field-label {
    font-size: 9px;
  }

  .top-controls .control-select {
    height: 34px;
    max-width: 145px;
    padding: 0 7px;
    font-size: 12px;
  }

  .manage-tags-button,
  .compact-notification-button,
  .file-menu-button {
    min-height: 34px;
  }

  .manage-tags-button {
    padding: 6px 9px;
    font-size: 11px;
  }

  /* Layout buttons remain reachable but compact */
  .layout-toggle {
    gap: 2px;
  }

  .layout-button {
    padding: 6px 8px;
  }

  /*
    Floating New Note button.
    Keeps note creation immediately reachable
    without consuming header width.
  */
  .new-note-button {
    position: fixed;
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 12000;

    width: 56px;
    height: 56px;
    padding: 0;

    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(58,49,39,.24);

    font-size: 0;
  }

  .new-note-button::before {
    content: "+";
    font-size: 30px;
    font-weight: 400;
    line-height: 1;
  }

  /* View navigation */
  .view-nav {
    justify-content: flex-start;
    gap: 3px;

    padding: 6px 8px 4px;

    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .view-nav::-webkit-scrollbar {
    display: none;
  }

  .view-button {
    flex: 0 0 auto;
    padding: 7px 9px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Get notes onto screen sooner */
  .main-content {
    width: calc(100% - 14px);
    padding-top: 8px;
    padding-bottom: 90px;
  }

  .section-heading {
    margin-bottom: 8px;
  }

  /* One clean phone-width card per row */
  .notes-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .note-card {
    min-height: 0;
    padding: 12px;
  }

  .note-card:hover {
    transform: none;
  }

  /* Editing becomes nearly full-screen */
  .editor-modal {
    top: 6px;
    bottom: 6px;
    left: 6px;

    width: calc(100vw - 12px);
    max-width: none;
    max-height: calc(100dvh - 12px);

    transform: none;

    border-radius: 14px;
    padding: 12px;
  }

  .note-title-input {
    font-size: 18px;
  }

  /*
    Keep formatting usable rather than shrinking it.
    Swipe horizontally when more controls are needed.
  */
  .format-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;

    margin: 5px 0 7px;
    padding: 5px;
  }

  .format-toolbar::-webkit-scrollbar {
    display: none;
  }

  .format-toolbar > * {
    flex: 0 0 auto;
  }

  .document-editor {
    min-height: 220px;
    max-height: 48dvh;
    padding-top: 18px;
    padding-bottom: 30px;
  }

  /* Meta fields stack comfortably on phone */
  .note-meta-strip {
    gap: 7px;
  }

  .note-meta-item {
    min-width: 0;
  }

  .composer-footer {
    gap: 8px;
    flex-wrap: wrap;
  }

  .composer-actions {
    margin-left: auto;
  }

  /* About should fit comfortably on a phone */
  .about-rnc-modal {
    padding: 8px;
  }

  .about-rnc-panel {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 24px 18px 18px;
    border-radius: 15px;
  }

  .about-rnc-header {
    align-items: flex-start;
    gap: 11px;
    padding-right: 28px;
  }

  .about-rnc-brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 11px;
    font-size: 25px;
  }

  .about-rnc-panel h2 {
    font-size: 21px;
  }

  .about-rnc-product {
    font-size: 13px;
  }
}

/* Mobile New Note floating button hardening */
@media (max-width: 700px) {
  #newNoteButton.new-note-button {
    position: fixed !important;
    right: 16px !important;
    bottom: calc(18px + env(safe-area-inset-bottom)) !important;

    flex: 0 0 56px !important;
    width: 56px !important;
    min-width: 56px !important;
    max-width: 56px !important;

    height: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;

    padding: 0 !important;
    margin: 0 !important;

    border-radius: 50% !important;

    font-size: 0 !important;
    line-height: 0 !important;
    white-space: nowrap !important;

    display: grid !important;
    place-items: center !important;

    z-index: 12000 !important;
  }

  #newNoteButton.new-note-button::before {
    content: "+" !important;
    display: block;
    font-size: 30px !important;
    line-height: 1 !important;
    font-weight: 400 !important;
  }
}

/* Mobile editor: allow full modal scrolling above the keyboard */
@media (max-width: 700px) {
  .editor-modal {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  .document-editor {
    max-height: none !important;
    min-height: 42vh;
    overflow-y: visible !important;
  }

  .note-meta-strip {
    flex: 0 0 auto;
  }

  .composer-footer {
    flex: 0 0 auto;
  }
}

/* Mobile editor follows the visible viewport above the keyboard */
@media (max-width: 700px) {
  .editor-modal {
    position: fixed !important;

    top: calc(
      var(--rnc-mobile-vv-top, 0px) + 6px
    ) !important;

    bottom: auto !important;

    height: calc(
      var(--rnc-mobile-vv-height, 100dvh) - 12px
    ) !important;

    max-height: none !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;

    -webkit-overflow-scrolling: touch;
  }

  .document-editor {
    flex: 0 0 auto !important;

    min-height: 240px !important;
    max-height: none !important;

    overflow: visible !important;
  }

  .note-meta-strip,
  .composer-footer {
    flex: 0 0 auto !important;
  }
}

/* Mobile editor: keep footer clear of browser bottom chrome */
@media (max-width: 700px) {
  .editor-modal {
    scroll-padding-bottom: 90px;
  }

  .composer-footer {
    margin-bottom: 72px !important;
  }
}

/* Mobile editor: reserve space for browser bottom chrome */
@media (max-width: 700px) {
  .editor-modal {
    height: calc(
      var(--rnc-mobile-vv-height, 100dvh) - 84px
    ) !important;

    max-height: calc(
      var(--rnc-mobile-vv-height, 100dvh) - 84px
    ) !important;

    padding-bottom: 88px !important;
    scroll-padding-bottom: 110px !important;
  }

  .composer-footer {
    margin-bottom: 0 !important;
    padding-bottom: 18px !important;
  }
}

/* RNC Smartphone Layout - Mobile Pass 2 controls */
.mobile-controls-button {
  display: none;
}

@media (max-width: 700px) {
  .mobile-controls-button {
    display: block;
    order: -19;
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(255,255,255,.68);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    text-align: left;
  }

  .mobile-controls-button::after {
    content: " ▾";
  }

  .top-controls.mobile-controls-open
    .mobile-controls-button::after {
    content: " ▴";
  }

  .top-controls:not(.mobile-controls-open) > .file-menu,
  .top-controls:not(.mobile-controls-open) > .notification-button,
  .top-controls:not(.mobile-controls-open) > .top-field:not(.top-field-search),
  .top-controls:not(.mobile-controls-open) > .manage-tags-button,
  .top-controls:not(.mobile-controls-open) > .layout-toggle {
    display: none !important;
  }

  .top-controls.mobile-controls-open {
    align-items: stretch;
  }

  .top-controls.mobile-controls-open
    > .top-field:not(.top-field-search) {
    flex: 1 1 135px;
    min-width: 0;
  }

  .top-controls.mobile-controls-open
    > .top-field:not(.top-field-search)
    .control-select {
    width: 100%;
  }

  .top-controls.mobile-controls-open
    > .manage-tags-button {
    flex: 1 1 120px;
  }

  .top-controls.mobile-controls-open
    > .layout-toggle {
    flex: 1 1 100%;
    justify-content: center;
  }
}

/* Mobile editor normalization:
   compact normal notes + visual-viewport full screen */
@media (max-width: 700px) {

  /* Normal editor: don't reserve a giant empty writing area */
  .editor-modal:not(.note-fullscreen)
    .document-editor {
    min-height: 150px !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    overflow-y: visible !important;
  }

  /* Full-screen editor must obey the actual visible viewport */
  .composer.editor-modal.note-fullscreen {
    position: fixed !important;

    top: var(--rnc-mobile-vv-top, 0px) !important;
    right: 0 !important;
    bottom: auto !important;
    left: 0 !important;

    width: 100vw !important;

    height: calc(
      var(--rnc-mobile-vv-height, 100dvh) - 84px
    ) !important;

    max-height: calc(
      var(--rnc-mobile-vv-height, 100dvh) - 84px
    ) !important;

    box-sizing: border-box !important;

    margin: 0 !important;
    padding-bottom: 88px !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;

    border-radius: 0 !important;

    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: 110px !important;
  }

  /* In full screen, let the whole note scroll instead
     of trapping scrolling inside only the writing field. */
  .composer.note-fullscreen
    .document-editor {
    flex: 0 0 auto !important;
    min-height: 180px !important;
    max-height: none !important;
    overflow-y: visible !important;
  }

  .composer.note-fullscreen
    .note-meta-strip,
  .composer.note-fullscreen
    .composer-footer {
    flex: 0 0 auto !important;
  }
}

/* Mobile full screen should fill the visible viewport */
@media (max-width: 700px) {
  .composer.editor-modal.note-fullscreen {
    top: var(--rnc-mobile-vv-top, 0px) !important;
    right: 0 !important;
    bottom: auto !important;
    left: 0 !important;

    width: 100vw !important;

    height: var(
      --rnc-mobile-vv-height,
      100dvh
    ) !important;

    max-height: var(
      --rnc-mobile-vv-height,
      100dvh
    ) !important;

    margin: 0 !important;

    padding-bottom: 96px !important;

    border-radius: 0 !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;

    scroll-padding-bottom: 120px !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* Mobile Pass 2B - compact expanded Controls panel */
@media (max-width: 700px) {

  /* Controls button doesn't need half the screen */
  .mobile-controls-button {
    width: auto !important;
    min-width: 150px;
    align-self: flex-start;
    padding: 8px 14px;
  }

  /* Tighter vertical spacing when controls are open */
  .top-controls.mobile-controls-open {
    gap: 7px !important;
  }

  .top-controls.mobile-controls-open
    > .top-field:not(.top-field-search) {
    flex: 1 1 calc(50% - 8px);
  }

  .top-controls.mobile-controls-open
    .top-field-label {
    margin-bottom: 3px;
    font-size: 11px;
  }

  .top-controls.mobile-controls-open
    .control-select {
    min-height: 42px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .top-controls.mobile-controls-open
    > .manage-tags-button {
    min-height: 42px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .top-controls.mobile-controls-open
    > .layout-toggle {
    margin-top: 0;
    padding-top: 0;
  }

  .top-controls.mobile-controls-open
    .layout-button {
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

/* Mobile: Freeform is desktop/tablet only */
@media (max-width: 700px) {
  #freeformViewButton {
    display: none !important;
  }
}

/* =========================================================
   RNC Security Setup - Phase 2
   ========================================================= */

.rnc-security-modal {
  position: fixed;
  inset: 0;
  z-index: 30000;

  display: grid;
  place-items: center;

  padding: 20px;
}

.rnc-security-modal.hidden {
  display: none !important;
}

.rnc-security-backdrop {
  position: absolute;
  inset: 0;

  padding: 0;
  border: 0;

  background:
    rgba(40, 35, 30, .58);

  backdrop-filter:
    blur(5px);
}

.rnc-security-panel {
  position: relative;
  z-index: 1;

  width:
    min(560px, 100%);

  max-height:
    calc(100dvh - 40px);

  overflow-y: auto;

  box-sizing: border-box;

  padding: 24px;

  border:
    1px solid var(--border);

  border-radius: 18px;

  background:
    #fffdf8;

  box-shadow:
    0 22px 70px
    rgba(30, 25, 20, .25);
}

.rnc-security-heading {
  display: flex;
  align-items: flex-start;
  justify-content:
    space-between;

  gap: 18px;

  margin-bottom: 20px;
}

.rnc-security-heading h2 {
  margin:
    0 0 5px;

  font-size: 22px;
}

.rnc-security-heading p {
  margin: 0;

  color: var(--muted);

  line-height: 1.45;
}

.rnc-login-version {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.rnc-login-active-file {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.rnc-login-active-file strong {
  font-weight: 800;
}

.rnc-login-active-file span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

.rnc-login-update {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid #cfc2b0;
  border-radius: 13px;
  background: #f8f3ea;
}

.rnc-login-update-heading {
  display: grid;
  gap: 2px;
}

.rnc-login-update-heading h3 {
  margin: 0;
  font-size: 16px;
}

.rnc-login-update-heading span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

body.rnc-update-available .rnc-login-update-prominent {
  border-color: #4d8b63;
  background: #edf8f0;
  box-shadow: 0 0 0 2px rgba(77,139,99,.10);
}

body.rnc-update-available .rnc-login-update-heading h3,
body.rnc-update-available .rnc-login-update-status {
  color: #245f3b;
}

.rnc-login-update-status {
  min-height: 18px;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.rnc-login-update-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.rnc-login-update-actions button {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 13px;
}

.rnc-login-update.is-current {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
}

.rnc-login-update.is-current .rnc-login-update-heading span {
  display: none;
}

.rnc-login-update.is-current .rnc-login-update-heading h3,
.rnc-login-update.is-current .rnc-login-update-status {
  font-size: 12px;
  line-height: 1.25;
}

.rnc-login-update.is-current .rnc-login-update-status {
  min-height: 0;
}

.rnc-login-update.is-current .rnc-login-update-actions {
  margin-top: 0;
}

.rnc-login-update.is-current .rnc-login-update-actions button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.rnc-password-requirement-modal {
  z-index: 31000;
}

.rnc-password-requirement-modal .rnc-security-panel {
  width: min(500px, 100%);
}

.rnc-password-requirement-message {
  display: grid;
  gap: 9px;
  margin-bottom: 16px;
  padding: 15px 16px;
  border: 2px solid #b98a32;
  border-radius: 12px;
  background: #fff2bf;
}

.rnc-password-requirement-message h2,
.rnc-password-requirement-message p {
  margin: 0;
}

.rnc-google-visibility-repair {
  border: 2px solid #b7791f;
  background: #fff7dc;
  box-shadow: 0 0 0 3px rgba(183, 121, 31, .08);
}

.rnc-google-visibility-repair button {
  width: 100%;
}

@media (max-width: 520px) {
  .rnc-login-update.is-current {
    grid-template-columns: 1fr auto;
  }

  .rnc-login-update.is-current .rnc-login-update-heading {
    display: none;
  }
}

.rnc-unlock-notebook-actions {
  display: grid;
  gap: 9px;
  margin: 14px 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fffdf9;
}

.rnc-unlock-notebook-actions h3,
.rnc-unlock-notebook-actions p {
  margin: 0;
}

.rnc-unlock-notebook-actions h3 {
  font-size: 16px;
}

.rnc-unlock-notebook-actions p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.rnc-unlock-notebook-actions .rnc-unlock-notebook-requirement {
  margin-top: 8px;
  padding: 11px 12px;
  border: 2px solid #b98a32;
  border-radius: 10px;
  background: #fff2bf;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.rnc-unlock-notebook-requirement strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.rnc-unlock-notebook-actions .rnc-security-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.rnc-unlock-notebook-actions .rnc-security-actions button {
  width: 100%;
  min-height: 42px;
}

.rnc-unlock-notebook-actions button.is-selected {
  border-color: var(--accent-dark);
  background: #efe5d4;
  box-shadow: 0 0 0 2px rgba(120,110,98,.10);
}

.rnc-unlock-notebook-actions > .rnc-quiet-button {
  justify-self: start;
}

.rnc-unlock-action-notice {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 2px solid #b98a32;
  border-radius: 11px;
  background: #fff2bf;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(120, 90, 35, .14);
}

.rnc-unlock-action-notice strong {
  font-size: 16px;
}

.rnc-unlock-action-notice.hidden {
  display: none !important;
}

#rncSecurityCloseButton {
  flex: 0 0 auto;

  width: 36px;
  height: 36px;

  border:
    1px solid var(--border);

  border-radius: 10px;

  background: white;

  font-size: 24px;
  line-height: 1;

  cursor: pointer;
}

#rncSecurityCloseButton[hidden] {
  display: none !important;
}

.rnc-security-step {
  display: grid;

  gap: 14px;
}

.rnc-unlock-method {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 255, 255, .58);
}

.rnc-unlock-method h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

.rnc-device-unlock-method {
  margin-bottom: 12px;
  border-color: rgba(116, 95, 68, .3);
  background: rgba(116, 95, 68, .06);
}

.rnc-device-unlock-method .rnc-security-actions,
.rnc-device-unlock-method .rnc-security-actions button {
  width: 100%;
}

.rnc-unlock-or {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.rnc-show-password-option {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  margin-top: -4px;
  font-size: .92rem;
  font-weight: 500 !important;
}

.rnc-device-unlock-offer {
  display: grid;
  gap: 6px;
  padding: 11px;
  border-radius: 10px;
  background: #f7f3eb;
}

.rnc-device-unlock-offer.hidden,
.rnc-security-ack.hidden {
  display: none !important;
}

.rnc-step-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.rnc-quiet-button {
  width: fit-content;
  min-height: 36px;
  padding: 7px 11px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.rnc-quiet-button:hover {
  color: var(--text);
}

.rnc-login-about {
  display: block;
  margin: 10px auto 0;
}

.rnc-reset-section {
  margin-top: 4px;
  padding-top: 2px;
}

.rnc-reset-section summary {
  width: fit-content;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.rnc-reset-note {
  margin: 10px 0;
  padding: 11px 12px;
  border-radius: 11px;
  background: #f7f3eb;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.rnc-danger-button {
  min-height: 40px;
  border: 1px solid #b96d64;
  background: #fff8f6;
  color: #8c342b;
}

.rnc-danger-button:hover {
  background: #fce9e5;
}

.rnc-security-step.hidden {
  display: none !important;
}

.rnc-security-step label {
  display: grid;

  gap: 6px;

  font-weight: 650;
}

.rnc-security-step
  input[type="password"] {
  width: 100%;

  box-sizing: border-box;

  padding: 11px 12px;

  border:
    1px solid var(--border);

  border-radius: 11px;

  background: white;

  font: inherit;
}

.rnc-field-requirement {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.rnc-security-help {
  margin: 0;

  color: var(--muted);

  font-size: 13px;

  line-height: 1.45;
}

.rnc-security-warning {
  margin: 0;

  padding: 10px 12px;

  border-radius: 10px;

  background:
    #fff2bf;

  font-size: 13px;

  line-height: 1.45;
}

.rnc-selected-notebook-password-guidance {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
  padding: 12px 13px;
  border: 2px solid #b98a32;
  border-radius: 11px;
  background: #fff2bf;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.rnc-selected-notebook-password-guidance strong {
  font-size: 15px;
}

.rnc-recovery-key {
  padding: 14px;

  border:
    1px solid var(--border);

  border-radius: 11px;

  background:
    #f7f3eb;

  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;

  font-size: 14px;

  line-height: 1.6;

  overflow-wrap:
    anywhere;

  user-select: all;
}

.rnc-security-ack {
  display: flex !important;

  grid-template-columns:
    none !important;

  align-items:
    flex-start;

  gap: 9px !important;

  font-weight:
    500 !important;
}

.rnc-security-actions {
  display: flex;

  flex-wrap: wrap;

  gap: 8px;
}

.rnc-security-status {
  min-height: 18px;

  margin:
    16px 0 0;

  color: var(--muted);

  font-size: 13px;
}

.rnc-security-status.error {
  color: #a42f2f;
}

.rnc-security-status.is-unlocking {
  position: fixed;
  inset: 0;
  z-index: 4;

  display: grid;
  place-items: center;

  min-height: 0;
  margin: 0;
  padding: 20px;

  background: rgba(40, 35, 30, .48);
  color: var(--ink);
}

.rnc-security-status.is-unlocking
  .rnc-security-status-message {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;

  width: min(390px, calc(100vw - 40px));
  min-height: 78px;
  padding: 18px 22px;

  border: 1px solid var(--border);
  border-radius: 16px;

  background: #fffdf8;
  box-shadow: 0 18px 55px rgba(30, 25, 20, .28);

  font-size: 17px;
  font-weight: 750;
  line-height: 1.35;
  text-align: center;
}

.rnc-security-status.is-unlocking
  .rnc-security-status-message::before {
  content: "";
  flex: 0 0 auto;

  width: 20px;
  height: 20px;

  border: 3px solid rgba(116, 95, 68, .25);
  border-top-color: var(--accent);
  border-radius: 50%;

  animation: rnc-unlock-spin .8s linear infinite;
}

@keyframes rnc-unlock-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rnc-security-status.is-unlocking
    .rnc-security-status-message::before {
    animation: none;
    border-color: var(--accent);
  }
}

@media (max-width: 700px) {
  .rnc-security-modal {
    padding: 8px;
  }

  .rnc-security-panel {
    width:
      calc(100vw - 16px);

    max-height:
      calc(100dvh - 16px);

    padding:
      20px 16px;

    border-radius:
      15px;
  }
}


/* =========================================================
   RNC organized card full-height correction
   ========================================================= */

.notes-grid:not(.freeform-view) .note-card {
  height: auto !important;
  max-height: none !important;
  overflow: hidden !important;
}

/*
  Only the preview body is truncated.
  Metadata and action controls must always remain visible.
*/
.notes-grid:not(.freeform-view) .card-preview {
  max-height: 145px;
  overflow: hidden;
}

.notes-grid:not(.freeform-view) .card-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
  overflow: visible;
}

/*
  Packed measures card height for masonry rows.
  Force cards to size naturally before measurement.
*/
.notes-grid.packed-view .note-card {
  height: auto !important;
  max-height: none !important;
}


/* =========================================================
   RNC phone workspace - content-first mobile layer
   Desktop and tablet retain the established workspace.
   ========================================================= */

.mobile-secondary-controls,
.editor-secondary-options {
  display: contents;
}

.mobile-controls-heading,
.mobile-controls-backdrop,
.mobile-editor-header,
.mobile-card-menu,
.mobile-new-note-button,
.mobile-quick-sort,
.mobile-format-menu-button,
.mobile-format-popover,
.mobile-spellcheck-toggle {
  display: none;
}

/* Preserve the established desktop control order after
   grouping the phone-only secondary controls. */
.top-controls > .new-note-button {
  order: 1;
}

.top-controls .file-menu {
  order: -100;
}

.top-controls .notification-button {
  order: 3;
}

.top-controls .notebook-filter-field {
  order: 4;
}

.top-controls > .top-field-search {
  order: 5;
}

.top-controls .tag-filter-field {
  order: 7;
}

.top-controls .manage-tags-button {
  order: 8;
}

.top-controls .sort-field {
  order: 9;
}

.top-controls .layout-toggle {
  order: 10;
}

/*
  Desktop header safeguard.

  The Auto Save status is part of the brand block so it can become a
  clear full-width row on phones. On desktop it needs its own grid row;
  otherwise it competes with the product name for the same 330px brand
  column and can push or clip the controls beside it.
*/
@media (min-width: 1251px) {
  .topbar {
    grid-template-columns: 370px minmax(0, 1fr) !important;
  }

  .brand {
    display: grid !important;
    grid-template-columns: 45px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 13px !important;
    row-gap: 5px;
    width: 370px !important;
    overflow: visible;
  }

  .brand-mark {
    grid-row: 1 / 3;
  }

  .brand > div:not(.brand-mark) {
    grid-column: 2;
    min-width: 0;
  }

  .brand h1 {
    font-size: 18px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .portable-auto-save-status {
    grid-column: 2;
    justify-self: start;
    max-width: 100%;
    margin: 0;
  }

  .top-controls {
    flex-wrap: wrap;
  }
}

@media (min-width: 701px) and (max-width: 1250px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    row-gap: 10px;
  }

  .brand {
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible;
  }

  .brand h1 {
    white-space: nowrap;
  }

  .top-controls {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

/* Calm, proportionate desktop and tablet header sizing. */
@media (min-width: 701px) {
  .topbar {
    column-gap: 14px !important;
    padding: 8px 14px !important;
  }

  .brand {
    gap: 9px !important;
  }

  .brand-mark {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 12px !important;
    font-size: 21px !important;
  }

  .brand h1 {
    font-size: 17px !important;
  }

  .creator {
    margin-top: 1px;
    font-size: 10px;
  }

  .portable-auto-save-status[data-state="protected"] {
    min-height: 29px;
    padding: 4px 9px;
    font-size: 10px;
  }

  .protection-status-secondary {
    font-size: 9px;
  }

  .top-controls {
    gap: 7px !important;
  }

  .top-controls .control-select,
  .top-controls .search-input,
  #newNoteButton,
  #manageTagsButton,
  .top-controls .file-menu-button,
  .top-controls .notification-button {
    height: 34px !important;
    min-height: 34px !important;
    font-size: 11px !important;
  }

  #newNoteButton,
  #manageTagsButton,
  .top-controls .file-menu-button {
    padding-right: 10px !important;
    padding-left: 10px !important;
  }

  .top-controls .notification-button {
    width: 36px;
    min-width: 36px;
    padding: 0 !important;
  }

  .top-field-label,
  .layout-toggle::before {
    margin-bottom: 2px;
    font-size: 7px !important;
  }

  .top-field #notebookFilterSelect {
    width: 130px;
    min-width: 130px;
  }

  .top-controls .top-field-search {
    flex: 1 1 170px;
    min-width: 140px;
    max-width: 200px;
  }

  .top-field #tagFilterSelect {
    width: 98px;
    min-width: 98px;
  }

  .top-field #sortSelect {
    width: 128px;
    min-width: 128px;
  }

  .top-controls .layout-toggle {
    gap: 1px;
    padding-top: 10px;
  }

  .top-controls .layout-button,
  .top-controls .view-button {
    min-width: 28px;
    min-height: 34px;
    padding: 6px 7px;
    font-size: 11px !important;
  }
}

@media (min-width: 1251px) {
  .topbar {
    grid-template-columns: 350px minmax(0, 1fr) !important;
  }

  .brand {
    grid-template-columns: 40px minmax(0, 1fr) !important;
    width: 350px !important;
    column-gap: 10px !important;
  }

  .top-controls {
    flex-wrap: nowrap !important;
  }
}

@media (min-width: 1001px) and (max-width: 1250px) {
  .top-controls {
    flex-wrap: nowrap;
  }

  .top-controls .top-field-search {
    max-width: none;
  }
}

@media (min-width: 701px) and (max-width: 1000px) {
  .top-controls {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 7px !important;
  }

  .top-controls > .new-note-button {
    grid-column: 1;
    grid-row: 1;
    width: max-content;
    margin: 0 !important;
  }

  .top-controls .file-menu {
    grid-column: 2;
    grid-row: 1;
  }

  .top-controls .notification-button {
    grid-column: 3;
    grid-row: 1;
  }

  .top-controls .notebook-filter-field {
    grid-column: 4 / span 2;
    grid-row: 1;
  }

  .top-controls > .top-field-search {
    grid-column: 6 / -1;
    grid-row: 1;
    width: 100%;
    max-width: none;
  }

  .top-controls .tag-filter-field {
    grid-column: 1 / span 2;
    grid-row: 2;
  }

  .top-controls .manage-tags-button {
    grid-column: 3 / span 2;
    grid-row: 2;
    width: max-content;
    margin: 0 !important;
  }

  .top-controls .sort-field {
    grid-column: 5 / span 3;
    grid-row: 2;
  }

  .top-controls .layout-toggle {
    grid-column: 8 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

  .top-controls .top-field,
  .top-controls .control-select,
  .top-controls .top-field-search,
  .top-controls .search-input {
    width: 100% !important;
    min-width: 0 !important;
  }

  .top-controls .sort-field,
  .top-controls .sort-field .control-select {
    width: 150px !important;
    min-width: 150px !important;
  }
}

@media (max-width: 700px) {
  html,
  body {
    overscroll-behavior-y: none;
  }

  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  body.mobile-controls-sheet-open {
    overflow: hidden;
  }

  .topbar {
    position: sticky !important;
    top: 0;
    z-index: 40;
    display: flex !important;
    flex-direction: column;
    gap: 8px !important;
    padding: 8px 10px 9px !important;
    background: rgba(245, 241, 232, .99) !important;
    backdrop-filter: none !important;
  }

  .brand {
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
    gap: 8px !important;
  }

  .brand-mark {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 10px !important;
    font-size: 20px !important;
  }

  .brand h1 {
    overflow: hidden;
    font-size: 16px !important;
    line-height: 1.1 !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .creator {
    font-size: 9px !important;
  }

  .top-controls,
  .top-controls.mobile-controls-open {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 96px 42px !important;
    align-items: center !important;
    gap: 7px !important;
    width: 100%;
  }

  .top-controls > .top-field-search {
    order: 1 !important;
    grid-column: 1 !important;
    width: 100%;
  }

  .mobile-quick-sort {
    order: 2 !important;
    display: block;
    grid-column: 2 !important;
    min-width: 0;
  }

  .mobile-quick-sort .control-select {
    width: 100%;
    min-width: 0;
    height: 42px;
    min-height: 42px;
    padding: 7px 25px 7px 9px;
    border-radius: 13px;
    font-size: 12px;
  }

  .top-field-search .search-input {
    width: 100%;
    height: 42px;
    min-height: 42px;
    padding: 9px 12px;
    border-radius: 13px;
    font-size: 14px;
  }

  .mobile-controls-button,
  .top-controls.mobile-controls-open .mobile-controls-button {
    order: 3 !important;
    display: grid !important;
    grid-column: 3 !important;
    place-items: center;
    align-self: auto !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px;
    min-height: 42px;
    padding: 0 !important;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--panel-bg);
    color: var(--text);
    font-size: 0 !important;
    text-align: center;
  }

  .mobile-controls-button::after,
  .top-controls.mobile-controls-open
    .mobile-controls-button::after {
    content: "☷" !important;
    font-size: 20px;
    line-height: 1;
  }

  .mobile-secondary-controls {
    position: fixed;
    z-index: 20010;
    right: 8px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    left: 8px;
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    max-height: min(
      60dvh,
      calc(var(--rnc-mobile-vv-height, 100dvh) - 120px)
    );
    padding: 9px 10px 10px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 253, 248, .99);
    box-shadow: 0 20px 55px rgba(45, 38, 30, .32);
    transform: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .top-controls.mobile-controls-open
    .mobile-secondary-controls {
    display: grid !important;
  }

  .mobile-controls-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    padding: 0 1px 4px;
    border-bottom: 1px solid var(--border);
  }

  .mobile-controls-heading strong {
    font-size: 13px;
  }

  .mobile-controls-heading button {
    min-height: 29px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font-weight: 700;
  }

  .mobile-secondary-controls > .top-field,
  .mobile-secondary-controls > .manage-tags-button,
  .mobile-secondary-controls > .file-menu,
  .mobile-secondary-controls > .notification-button {
    order: initial !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .mobile-secondary-controls > .file-menu,
  .mobile-secondary-controls > .notification-button {
    display: block !important;
  }

  .mobile-secondary-controls .file-menu-button,
  .mobile-secondary-controls .notification-button,
  .mobile-secondary-controls .manage-tags-button,
  .mobile-secondary-controls .control-select {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 36px;
    height: 36px;
    padding-top: 5px;
    padding-bottom: 5px;
    font-size: 12px;
  }

  .mobile-secondary-controls .sort-field {
    display: none !important;
  }

  .mobile-secondary-controls .top-field-label {
    margin-bottom: 2px;
    font-size: 9px;
  }

  .mobile-secondary-controls .file-menu-button::after {
    content: none;
  }

  .mobile-secondary-controls .notification-button::after {
    content: "  Reminders";
  }

  .mobile-secondary-controls .layout-toggle {
    order: initial !important;
    grid-column: 1 / -1;
    display: grid !important;
    grid-template-columns: auto repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 6px;
    width: 100%;
    padding-top: 2px;
  }

  .mobile-secondary-controls .layout-button {
    min-height: 36px;
    font-size: 0;
  }

  .mobile-secondary-controls .layout-toggle::before {
    position: static !important;
    content: "View";
    display: inline;
    padding-right: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
  }

  .mobile-secondary-controls #packedViewButton,
  .mobile-secondary-controls #titleViewButton,
  .mobile-secondary-controls #freeformViewButton {
    display: none !important;
  }

  .mobile-secondary-controls #gridViewButton::after {
    content: "▦  Cards";
    font-size: 12px;
  }

  .mobile-secondary-controls #listViewButton::after {
    content: "☷  List";
    font-size: 12px;
  }

  .mobile-controls-backdrop {
    position: fixed;
    z-index: 35;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(45, 40, 34, .28);
    backdrop-filter: blur(2px);
  }

  body.mobile-controls-sheet-open
    .mobile-controls-backdrop {
    display: block;
  }

  body.mobile-controls-sheet-open
    .view-nav,
  body.mobile-controls-sheet-open
    .mobile-new-note-button {
    visibility: hidden;
  }

  body.editor-open .view-nav,
  body.editor-open .mobile-new-note-button {
    visibility: hidden;
  }

  #newNoteButton.new-note-button {
    display: none !important;
  }

  .mobile-new-note-button {
    position: fixed;
    z-index: 12000;
    right: 16px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    box-shadow: 0 8px 24px rgba(58, 49, 39, .26);
    font-size: 30px;
    font-weight: 400;
    line-height: 1;
  }

  .view-nav {
    position: fixed;
    z-index: 10000;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 2px;
    padding: 6px 5px calc(6px + env(safe-area-inset-bottom));
    overflow: visible;
    border-top: 1px solid rgba(221, 213, 200, .92);
    background: rgba(255, 253, 248, .97);
    box-shadow: 0 -5px 18px rgba(58, 49, 39, .08);
    backdrop-filter: blur(14px);
  }

  .view-button {
    min-width: 0;
    min-height: 43px;
    padding: 6px 2px;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .main-content {
    width: calc(100% - 16px);
    padding-top: 9px;
    padding-bottom: 104px;
  }

  .notes-grid,
  .notes-grid.packed-view,
  .notes-grid.title-view {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .notes-grid.list-view {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .notes-grid:not(.freeform-view) .note-card {
    width: 100%;
    min-height: 0;
    padding: 11px 39px 11px 11px;
    border-radius: 15px;
    cursor: pointer;
  }

  .notes-grid:not(.list-view):not(.freeform-view)
    .note-card {
    min-height: 118px;
  }

  .notes-grid:not(.list-view):not(.freeform-view)
    .card-title {
    font-size: 14px;
  }

  .notes-grid:not(.list-view):not(.freeform-view)
    .card-preview {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    font-size: 12px;
  }

  .notes-grid:not(.freeform-view) .drag-handle {
    display: none !important;
  }

  .mobile-card-menu {
    position: absolute;
    z-index: 2;
    top: 7px;
    right: 7px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, .52);
    color: var(--text);
    font-size: 22px;
    line-height: 1;
  }

  .notes-grid:not(.freeform-view) .card-actions {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin: 12px -31px 0 0;
    padding-top: 10px;
    border-top: 1px solid rgba(120, 110, 98, .16);
  }

  .notes-grid:not(.freeform-view)
    .note-card.mobile-actions-open
    .card-actions {
    display: grid;
  }

  .notes-grid:not(.freeform-view) .card-actions button {
    min-height: 42px;
    padding: 8px;
    font-size: 12px;
  }

  /* Full-height editor follows the visible viewport so the
     keyboard cannot cover Done, formatting, or More. */
  .editor-modal,
  .composer.editor-modal.note-fullscreen {
    position: fixed !important;
    top: var(--rnc-mobile-vv-top, 0px) !important;
    right: 0 !important;
    bottom: auto !important;
    left: 0 !important;
    display: flex;
    flex-direction: column;
    width: 100vw !important;
    height: var(--rnc-mobile-vv-height, 100dvh) !important;
    max-height: var(--rnc-mobile-vv-height, 100dvh) !important;
    margin: 0 !important;
    padding: 0 10px !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 0 !important;
    transform: none !important;
  }

  .mobile-editor-header {
    order: 0;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(120, 110, 98, .16);
  }

  .mobile-editor-header button {
    min-height: 38px;
    padding: 0 13px;
    border: 0;
    border-radius: 11px;
    font-weight: 700;
  }

  #mobileEditorOptionsButton {
    background: rgba(255, 255, 255, .62);
    color: var(--text);
  }

  #mobileEditorDoneButton {
    background: var(--accent);
    color: white;
  }

  .mobile-save-status {
    flex: 1;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .editor-modal > .note-title-row {
    order: 1;
    flex: 0 0 auto;
    margin: 6px 0 0;
  }

  .editor-modal > .note-metadata {
    order: 2;
    flex: 0 0 auto;
  }

  .editor-modal > .document-editor,
  .composer.note-fullscreen > .document-editor,
  .composer.editor-modal:not(.note-fullscreen)
    > .document-editor {
    order: 3;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 14px 4px 24px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .editor-modal > .format-toolbar {
    order: 4;
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    z-index: 6;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 2px;
    margin: 0 0 calc(7px + env(safe-area-inset-bottom));
    padding: 6px;
    overflow-x: auto;
    border-radius: 14px;
    background: rgba(255, 253, 248, .98);
    box-shadow: 0 5px 18px rgba(58, 49, 39, .12);
    scrollbar-width: none;
  }

  .editor-modal > .format-toolbar::-webkit-scrollbar {
    display: none;
  }

  /* Task boxes are a primary phone-writing action. Keep the
     checklist control at the leading edge instead of requiring
     a horizontal toolbar swipe to discover it. */
  .editor-modal > .format-toolbar
    #insertChecklistButton {
    order: -30;
    min-width: 56px;
    font-weight: 700;
  }

  .editor-modal > .format-toolbar
    #insertChecklistButton::after {
    content: " Task";
  }

  .editor-modal > .format-toolbar
    [data-command="insertUnorderedList"] {
    order: -29;
  }

  .editor-modal > .format-toolbar
    [data-command="insertOrderedList"] {
    order: -28;
  }

  .editor-modal > .format-toolbar
    .text-colors {
    order: -27;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 2px;
  }

  .editor-modal > .format-toolbar
    .text-colors #textColorSelect {
    display: none;
  }

  .editor-modal > .format-toolbar
    .text-colors .custom-color-label {
    display: none;
  }

  .editor-modal > .format-toolbar
    #fontFamily,
  .editor-modal > .format-toolbar
    #fontSize {
    display: none;
  }

  .editor-modal > .format-toolbar
    .mobile-format-menu-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 66px;
    min-height: 36px;
    padding: 5px 7px;
    border: 1px solid rgba(120, 110, 98, .16);
    border-radius: 9px;
    background: rgba(255, 255, 255, .72);
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
  }

  .editor-modal > .format-toolbar
    #mobileFontFamilyButton {
    order: -26;
    min-width: 76px;
  }

  .editor-modal > .format-toolbar
    #mobileFontSizeButton {
    order: -25;
    min-width: 72px;
  }

  .mobile-text-color-button::before {
    width: 12px;
    height: 12px;
    margin-right: 5px;
    border: 1px solid rgba(0, 0, 0, .24);
    border-radius: 50%;
    background: var(
      --rnc-selected-text-color,
      linear-gradient(
        135deg,
        #0057ff 0 25%,
        #d90000 25% 50%,
        #008c3a 50% 75%,
        #8a21c7 75%
      )
    );
    content: "";
  }

  .mobile-format-popover {
    position: absolute;
    z-index: 9;
    right: 8px;
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 8px;
    max-height: min(42dvh, 210px);
    padding: 9px 10px 10px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: rgba(255, 253, 248, .99);
    box-shadow: 0 18px 48px rgba(45, 38, 30, .30);
    overscroll-behavior: contain;
  }

  .mobile-format-popover.is-open {
    display: grid;
    gap: 7px;
  }

  .mobile-format-popover-title {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .mobile-format-popover-choices {
    display: grid;
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .mobile-format-choice {
    min-height: 35px;
    padding: 5px 8px;
    border: 1px solid rgba(120, 110, 98, .16);
    border-radius: 9px;
    background: rgba(255, 255, 255, .75);
    color: var(--text);
    font-size: 12px;
    text-align: left;
  }

  .mobile-format-popover.is-size-menu
    .mobile-format-popover-choices {
    grid-template-columns:
      repeat(5, minmax(0, 1fr));
  }

  .mobile-format-popover.is-size-menu
    .mobile-format-choice {
    padding: 5px 2px;
    font-size: 11px;
    text-align: center;
  }

  .mobile-format-popover.is-color-menu
    .mobile-format-popover-choices {
    grid-template-columns:
      repeat(8, minmax(0, 1fr));
  }

  .mobile-format-color-choice {
    position: relative;
    min-width: 0;
    min-height: 37px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .mobile-format-color-choice::before {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 25px;
    height: 25px;
    border: 2px solid rgba(255, 255, 255, .96);
    border-radius: 50%;
    background: var(--rnc-text-color-choice);
    box-shadow:
      0 0 0 1px rgba(65, 55, 45, .25),
      0 2px 5px rgba(65, 55, 45, .16);
    content: "";
    transform: translate(-50%, -50%);
  }

  .editor-secondary-options {
    position: absolute;
    z-index: 8;
    right: 8px;
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 8px;
    display: none;
    max-height: min(48dvh, 250px);
    padding: 9px 10px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: rgba(255, 253, 248, .99);
    box-shadow: 0 18px 48px rgba(45, 38, 30, .30);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .editor-modal.mobile-editor-options-open
    .editor-secondary-options {
    display: grid;
    gap: 6px;
  }

  .editor-secondary-options .note-meta-strip {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px 8px !important;
    margin: 0 !important;
  }

  .editor-secondary-options .note-meta-item {
    min-width: 0 !important;
  }

  .editor-secondary-options .note-meta-item label,
  .editor-secondary-options .note-meta-label {
    margin-bottom: 2px !important;
    font-size: 9px;
    line-height: 1;
  }

  .editor-secondary-options .note-notebook-editor select,
  .editor-secondary-options .note-tags-editor input,
  .editor-secondary-options .note-reminder-controls input,
  .editor-secondary-options .compact-reminder-clear,
  .editor-secondary-options .note-tags-picker-button {
    min-height: 30px !important;
    height: 30px !important;
    font-size: 11px;
  }

  .editor-secondary-options .note-tags-picker-button {
    padding: 3px 6px;
  }

  .editor-secondary-options .note-reminder-editor {
    grid-column: 1 / -1;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
  }

  .editor-secondary-options .note-reminder-editor
    .note-meta-label {
    margin: 0 !important;
  }

  .editor-secondary-options .note-reminder-controls {
    display: grid !important;
    grid-template-columns:
      minmax(0, 1.15fr)
      minmax(0, .85fr)
      auto !important;
    gap: 4px !important;
  }

  .editor-secondary-options .compact-reminder-clear {
    min-width: 43px;
    padding: 3px 5px;
  }

  .editor-secondary-options .composer-footer {
    position: static !important;
    display: grid !important;
    grid-template-columns:
      minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 5px 8px;
    margin: 0 !important;
    padding: 6px 0 0 !important;
    border-top: 1px solid var(--border);
    background: transparent !important;
  }

  .editor-secondary-options .color-picker {
    grid-column: 1 / -1;
    justify-content: space-between;
    gap: 4px;
  }

  .editor-secondary-options .color-swatch {
    width: 23px;
    height: 23px;
  }

  .editor-secondary-options .date-toggle {
    font-size: 11px;
    white-space: nowrap;
  }

  .editor-secondary-options
    .mobile-spellcheck-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    white-space: nowrap;
  }

  .editor-secondary-options .save-status {
    display: none !important;
  }

  .editor-secondary-options .composer-actions {
    display: block;
    width: auto;
    margin: 0;
  }

  .editor-secondary-options .composer-actions button {
    min-height: 30px;
    padding: 3px 10px;
    font-size: 11px;
  }

  .editor-secondary-options #saveNoteButton,
  .editor-secondary-options #closeNoteButton,
  .editor-secondary-options #fullscreenNoteButton {
    display: none !important;
  }
}



/* =========================================================
   RNC organized-view marquee selection
   ========================================================= */

.organized-marquee {
  position: fixed;
  z-index: 20000;
  pointer-events: none;

  border:
    1.5px solid
    rgba(0, 87, 255, 0.72);

  border-radius: 5px;

  background:
    rgba(0, 87, 255, 0.09);

  box-shadow:
    inset 0 0 0 1px
    rgba(255, 255, 255, 0.35);
}

body.organized-marquee-active {
  cursor: crosshair;
  user-select: none;
}


/* =========================================================
   RNC Note Editor — Existing Tag Picker
   ========================================================= */

.note-tags-input-area {
  flex: 1 1 auto;
  min-width: 0;
}

.note-tags-input-area #noteTagsInput {
  width: 100%;
  box-sizing: border-box;
}

.note-existing-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;

  margin-top: 6px;
}

.note-existing-tags.hidden {
  display: none;
}

.note-existing-tag {
  min-height: 26px;
  padding: 3px 9px;

  border: 1px solid var(--border);
  border-radius: 999px;

  background: rgba(255,255,255,.55);

  color: inherit;
  font: inherit;
  font-size: 11px;

  cursor: pointer;
}

.note-existing-tag:hover {
  background: rgba(255,255,255,.82);
}

.note-existing-tag.selected {
  border-color: var(--accent-dark);
  background: rgba(120,110,98,.18);
  font-weight: 650;
}


/* =========================================================
   RNC Compact Collapsible Tag Picker
   ========================================================= */

.note-tags-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.note-tags-input-row #noteTagsInput {
  flex: 1 1 auto;
  min-width: 0;
}

.note-tags-picker-button {
  flex: 0 0 auto;

  min-height: 34px;
  padding: 5px 9px;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: rgba(255,255,255,.68);

  color: inherit;
  font: inherit;
  font-size: 11px;
  font-weight: 650;

  cursor: pointer;
}

.note-tags-picker-button:hover {
  background: rgba(255,255,255,.9);
}

.note-tags-picker-button:disabled {
  opacity: .45;
  cursor: default;
}

.note-existing-tags {
  margin-top: 6px;
  padding: 7px;

  border: 1px solid rgba(120,110,98,.16);
  border-radius: 9px;

  background: rgba(255,255,255,.30);
}

.note-existing-tags.hidden {
  display: none;
}


/* =========================================================
   RNC Tag Selector — Compact Dropdown List
   ========================================================= */

.note-existing-tags {
  display: block;

  max-height: 190px;
  overflow-y: auto;

  margin-top: 5px;
  padding: 4px;

  border: 1px solid var(--border);
  border-radius: 8px;

  background: rgba(255,255,255,.94);

  box-shadow:
    0 4px 12px rgba(0,0,0,.10);
}

.note-existing-tags.hidden {
  display: none;
}

.note-existing-tag {
  display: flex;
  align-items: center;
  gap: 7px;

  width: 100%;
  min-height: 30px;

  margin: 0;
  padding: 5px 8px;

  border: 0;
  border-radius: 5px;

  background: transparent;

  color: inherit;
  font: inherit;
  font-size: 12px;
  text-align: left;

  cursor: pointer;
}

.note-existing-tag:hover {
  background: rgba(120,110,98,.10);
}

.note-existing-tag.selected {
  background: rgba(120,110,98,.16);
  font-weight: 650;
}

.note-tag-select-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 16px;
  min-width: 16px;

  font-weight: 700;
}


/* =========================================================
   RNC Tag Selector — Floating Compact Menu
   ========================================================= */

.note-tags-input-area {
  position: relative;
}

.note-tags-input-row {
  position: relative;
}

.note-existing-tags {
  position: absolute;

  top: calc(100% + 5px);
  right: 0;

  z-index: 1200;

  width: 220px;
  max-width: min(220px, 88vw);
  max-height: 230px;

  overflow-y: auto;

  margin: 0;
  padding: 4px;

  border: 1px solid var(--border);
  border-radius: 10px;

  background: rgba(255,255,255,.98);

  box-shadow:
    0 8px 22px rgba(0,0,0,.14);
}

.note-existing-tags.hidden {
  display: none;
}

.note-existing-tag {
  display: flex;
  align-items: center;
  gap: 8px;

  width: 100%;
  min-height: 32px;

  margin: 0;
  padding: 6px 9px;

  border: 0;
  border-radius: 7px;

  background: transparent;

  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;

  cursor: pointer;
}

.note-existing-tag + .note-existing-tag {
  margin-top: 1px;
}

.note-existing-tag:hover {
  background: rgba(120,110,98,.10);
}

.note-existing-tag.selected {
  background: rgba(120,110,98,.16);
  font-weight: 650;
}

.note-tag-select-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 16px;
  min-width: 16px;

  font-size: 12px;
  font-weight: 700;
}


/* =========================================================
   RNC Tag Selector — Open Upward
   ========================================================= */

.note-existing-tags {
  top: auto;
  bottom: calc(100% + 5px);
  right: 0;
}


/* =========================================================
   RNC Secure Startup Lock Gate
   ========================================================= */

body.rnc-app-locked .app-shell {
  display: none !important;
}

.rnc-unlock-panel {
  width: min(520px, 100%);
}

.rnc-device-unlock-setup-panel {
  width: min(460px, 100%);
}

.rnc-device-unlock-privacy {
  padding: 12px;
  border-radius: 11px;
  background: #f7f3eb;
}

.rnc-device-unlock-setup-actions {
  margin-top: 2px;
}

@media (max-width: 700px) {
  .rnc-unlock-notebook-actions .rnc-security-actions {
    grid-template-columns: 1fr;
  }

  .rnc-device-unlock-setup-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .rnc-device-unlock-setup-actions button {
    width: 100%;
    min-height: 46px;
  }
}

#rncUnlockRecoveryKey {
  width: 100%;
  box-sizing: border-box;

  min-height: 96px;
  padding: 11px 12px;

  resize: vertical;

  border: 1px solid var(--border);
  border-radius: 11px;

  background: white;

  color: inherit;
  font: inherit;
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;

  line-height: 1.45;
}

#rncUnlockRecoveryKey:focus {
  border-color: var(--accent-dark);
  outline: 2px solid rgba(120,110,98,.12);
}

/* =========================================================
   Calm Data & Backup experience
   ========================================================= */

.file-menu-advanced-data {
  margin: 6px 0 2px;
  padding-top: 6px;
  border-top: 1px solid rgba(120, 110, 98, .18);
}

.file-menu-advanced-data summary {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.file-menu-advanced-data[open] summary {
  margin-bottom: 4px;
}

.rnc-data-backup-panel {
  width: min(560px, 100%);
}

.rnc-conflict-review-panel {
  width: min(980px, 100%);
}

.rnc-conflict-review-content,
.rnc-conflict-list {
  display: grid;
  gap: 14px;
}

.rnc-conflict-summary,
.rnc-conflict-explanation,
.rnc-conflict-settings {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #d7cdbf;
  border-radius: 12px;
  background: #fffaf2;
}

.rnc-merge-back-intro,
.rnc-merge-back-identical {
  display: grid;
  gap: 0.45rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--panel-bg);
}

.rnc-duplicate-cleanup-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.rnc-duplicate-cleanup-choice .rnc-quiet-button {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .rnc-duplicate-cleanup-choice {
    grid-template-columns: 1fr;
  }

  .rnc-duplicate-cleanup-choice .rnc-quiet-button {
    grid-column: auto;
  }
}

.rnc-conflict-summary span,
.rnc-conflict-explanation span,
.rnc-conflict-settings span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.rnc-conflict-note {
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid #ddd3c5;
  border-radius: 12px;
  background: #fffdf9;
}

.rnc-conflict-kind {
  color: #8a570c;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.rnc-conflict-differences,
.rnc-conflict-automatic {
  margin: 0;
  color: #4d4439;
  font-size: 13px;
  line-height: 1.4;
}

.rnc-conflict-differences strong {
  color: #704608;
}

.rnc-conflict-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
}

.rnc-conflict-column {
  min-width: 0;
  padding: 10px;
  border: 1px solid #e4dbcf;
  border-radius: 10px;
  background: #fff;
}

.rnc-conflict-column > strong,
.rnc-conflict-column h4,
.rnc-conflict-column time,
.rnc-conflict-column p {
  display: block;
  margin: 0 0 6px;
}

.rnc-conflict-column > strong {
  color: #6b5942;
  font-size: 11px;
  text-transform: uppercase;
}

.rnc-conflict-column h4 {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.rnc-conflict-column time {
  color: var(--muted);
  font-size: 11px;
}

.rnc-conflict-column p {
  max-height: 150px;
  overflow-y: auto;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.rnc-conflict-column.is-empty {
  color: var(--muted);
  background: #f7f3ed;
}

.rnc-conflict-note-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 2px 0 0;
  padding: 8px;
  border: 1px solid #d8ccbb;
  border-radius: 10px;
}

.rnc-conflict-note-choices.is-two-choice {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rnc-conflict-note-choices legend {
  padding: 0 5px;
  color: #5f513f;
  font-size: 12px;
  font-weight: 800;
}

.rnc-conflict-note-choices label {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px;
  border: 1px solid #e2d8ca;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.rnc-conflict-note-choices input {
  flex: 0 0 auto;
  margin-top: 3px;
}

.rnc-conflict-note-choices span,
.rnc-conflict-note-choices strong,
.rnc-conflict-note-choices small {
  display: block;
}

.rnc-conflict-note-choices small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.rnc-conflict-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rnc-conflict-actions .rnc-quiet-button {
  grid-column: 1 / -1;
  justify-self: center;
}

.rnc-conflict-no-notes {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: #f7f3ed;
}

.rnc-protection-summary {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid #a7ceb4;
  border-radius: 14px;
  background: #edf8f0;
  color: #245f3b;
}

.rnc-protection-summary strong {
  font-size: 17px;
}

.rnc-protection-summary span {
  color: #4f6858;
  font-size: 13px;
}

.rnc-data-backup-section {
  display: grid;
  gap: 8px;
  padding: 15px 0;
  border-bottom: 1px solid rgba(120, 110, 98, .16);
}

.rnc-data-backup-section h3,
.rnc-data-backup-section p {
  margin: 0;
}

.rnc-active-storage-card {
  margin-top: 12px;
}

.rnc-storage-details {
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(0, 1.3fr);
  gap: 6px 12px;
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

.rnc-storage-details dt {
  color: var(--muted);
  font-weight: 700;
}

.rnc-storage-details dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.rnc-save-sync-now {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #cfc2b0;
  border-radius: 12px;
  background: #f8f3eb;
}

.rnc-save-sync-now.needs-save {
  border-color: #9a671a;
  background: #fff3dc;
  box-shadow: 0 0 0 2px rgba(154, 103, 26, .10);
}

.rnc-save-sync-now .primary-button {
  width: 100%;
  min-height: 44px;
}

.rnc-save-sync-now > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.rnc-save-sync-now .rnc-security-status {
  margin: 0;
}

.rnc-online-backup-card {
  margin-top: 14px;
  padding: 15px 16px;
  border: 1px solid #d7cdbf;
  border-radius: 14px;
  background: #fffdf9;
}

.rnc-feature-label {
  color: #8a570c;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
}

.rnc-online-service-note {
  font-size: 12px !important;
}

.rnc-online-backup-card > .primary-button,
.rnc-online-backup-card > .secondary-button {
  width: 100%;
  margin-top: 8px;
}

.rnc-cloud-result {
  position: fixed;
  z-index: 40000;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  width: min(460px, calc(100vw - 28px));
  max-height: calc(100dvh - max(36px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  overflow: hidden;
  padding: 18px;
  border: 2px solid #57906b;
  border-radius: 16px;
  background: #fffdf9;
  box-shadow: 0 16px 40px rgba(45, 37, 27, .22);
  transform: translateX(-50%);
}

html.rnc-cloud-dialog-open,
body.rnc-cloud-dialog-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.rnc-cloud-result-backdrop {
  position: fixed;
  z-index: 39999;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(47, 43, 37, .46);
  cursor: default;
  touch-action: none;
}

.rnc-cloud-result-heading {
  display: grid;
  gap: 6px;
}

.rnc-cloud-result-scroll {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-gutter: stable;
}

.rnc-cloud-result-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  background: #fffdf9;
}

.rnc-cloud-result-footer .primary-button {
  flex: 1 1 260px;
}

.rnc-cloud-result.rnc-merge-back-review {
  width: min(980px, calc(100vw - 28px));
}

.rnc-cloud-result:not(:has(.rnc-cloud-result-scroll)) {
  grid-template-rows: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rnc-merge-back-store-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.rnc-merge-back-store-choice {
  background: #fffaf2;
}

.rnc-cloud-result.needs-attention {
  border-color: #b27b28;
}

.rnc-cloud-result strong {
  color: #245f3b;
  font-size: 18px;
}

.rnc-cloud-result.needs-attention strong {
  color: #70480b;
}

.rnc-cloud-result p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.rnc-cloud-file-choices {
  display: grid;
  gap: 8px;
  max-height: min(48vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rnc-cloud-file-choices button {
  width: 100%;
  text-align: left;
}

.rnc-cloud-file-choices button strong {
  color: inherit;
  font-size: inherit;
}

.rnc-cloud-file-choices button span {
  color: var(--muted);
  font-size: 12px;
}

.rnc-destination-repair-guidance,
.rnc-destination-repair-empty,
.rnc-destination-review-result {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 13px;
  border: 1px solid #d5c5ae;
  border-radius: 12px;
  background: #fffaf1;
}

.rnc-destination-candidates {
  display: grid;
  gap: 10px;
}

.rnc-destination-candidate {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.rnc-destination-candidate strong,
.rnc-destination-review-result h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.rnc-destination-candidate span {
  color: #245f3b;
  font-size: 12px;
  font-weight: 750;
}

.rnc-destination-candidate small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.rnc-destination-candidate button,
.rnc-destination-review-result button,
.rnc-destination-repair-empty + button {
  width: 100%;
  margin-top: 4px;
}

.rnc-cloud-reconnect-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.rnc-destination-unlock-handoff strong {
  color: #245f3b;
  font-size: inherit;
}

.rnc-recent-notebooks {
  display: grid;
  gap: 8px;
  max-height: min(34vh, 300px);
  overflow-y: auto;
}

.rnc-recent-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}

.rnc-recent-entry .rnc-recent-open {
  min-width: 0;
}

.rnc-recent-entry .rnc-recent-remove {
  align-self: center;
  min-height: 44px;
  padding: 8px 10px;
  white-space: normal;
}

.rnc-recent-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rnc-recent-heading h4 {
  margin-bottom: 8px;
}

.rnc-recent-notebooks button {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
}

.rnc-recent-notebooks button strong {
  color: inherit;
  font-size: 14px;
}

.rnc-recent-notebooks span,
.rnc-recent-notebooks small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .rnc-cloud-result {
    top: max(8px, env(safe-area-inset-top));
    width: calc(100vw - 16px);
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
    padding: 14px;
  }

  .rnc-cloud-result-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .rnc-cloud-result-footer .primary-button,
  .rnc-cloud-result-footer .rnc-quiet-button {
    flex: 0 0 auto;
    width: 100%;
  }

  .rnc-recent-entry {
    grid-template-columns: 1fr;
  }

  .rnc-recent-entry .rnc-recent-remove {
    width: 100%;
  }

  .rnc-storage-details {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .rnc-storage-details dd {
    margin-bottom: 6px;
  }
}

.rnc-cloud-result label {
  display: grid;
  gap: 6px;
  font-weight: 750;
}

.rnc-cloud-result input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #cbbfaf;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.rnc-cloud-return-guidance {
  display: grid;
  gap: 6px;
  margin: 16px 0 4px;
  padding: 14px 16px;
  border: 1px solid #8db99c;
  border-radius: 14px;
  background: #eef8f1;
}

.rnc-cloud-return-guidance strong {
  color: #245f3b;
  font-size: 17px;
}

.rnc-cloud-return-guidance p {
  margin: 0;
  color: #405a49;
  line-height: 1.45;
}

.rnc-data-backup-section p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.rnc-advanced-data-details {
  margin-top: 2px;
  padding: 12px 0 0;
}

.rnc-advanced-data-details summary {
  color: var(--muted);
  font-weight: 750;
  cursor: pointer;
}

.rnc-advanced-data-details p {
  margin: 9px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.rnc-cloud-setup-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 700px) {
  .portable-auto-save-status[data-state="protected"] {
    align-items: center;
    min-height: 42px;
    white-space: normal;
    text-align: center;
  }

  .protection-status-secondary {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rnc-cloud-setup-actions {
    grid-template-columns: 1fr;
  }

  .rnc-data-backup-section .rnc-security-actions {
    grid-template-columns: 1fr;
  }

  .rnc-conflict-review-panel {
    padding: 14px;
  }

  .rnc-conflict-columns {
    gap: 5px;
  }

  .rnc-conflict-column {
    padding: 7px;
  }

  .rnc-conflict-column h4 {
    font-size: 13px;
  }

  .rnc-conflict-column p {
    font-size: 11px;
  }

  .rnc-conflict-actions {
    grid-template-columns: 1fr;
  }

  .rnc-conflict-note-choices {
    grid-template-columns: 1fr;
  }

  .rnc-conflict-note-choices.is-two-choice {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .brand {
    flex-wrap: wrap;
  }

  .brand > div:not(.brand-mark) {
    min-width: 0;
    flex: 1 1 auto;
  }

  .portable-auto-save-status {
    order: 3;
    justify-content: center;
    width: 100%;
    min-height: 32px;
    margin: 0;
    padding: 5px 9px;
    font-size: 10px;
    white-space: nowrap;
    text-align: center;
  }
}


/* =========================================================
   Collapsed Container navigation and compact card overview
   ========================================================= */

.compact-card-view-icon {
  display: grid;
  grid-template-columns: repeat(3, 4px);
  grid-template-rows: repeat(2, 4px);
  gap: 1px;
}

.compact-card-view-icon span {
  display: block;
  border: 1px solid currentColor;
  border-radius: 1px;
}

.notes-grid.overview-view {
  grid-template-columns:
    repeat(auto-fill, minmax(140px, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: 2px;
  gap: 6px;
  align-items: start;
}

.notes-grid.overview-view .note-card {
  min-height: 82px !important;
  padding: 9px 10px !important;
  border-radius: 11px;
}

.notes-grid.overview-view .note-card h3 {
  margin-bottom: 5px;
  padding-right: 18px;
  font-size: 12px;
  line-height: 1.25;
}

.notes-grid.overview-view .card-preview {
  display: -webkit-box;
  max-height: 58px !important;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.notes-grid.overview-view .card-preview .note-image {
  max-height: 54px;
  object-fit: cover;
}

.notes-grid.overview-view .card-actions,
.notes-grid.overview-view .note-tag-list,
.notes-grid.overview-view .note-date,
.notes-grid.overview-view .pin-label {
  display: none !important;
}

.notes-grid.overview-view .drag-handle {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
}

/* Search stays proportionate instead of consuming spare toolbar width. */
@media (min-width: 1001px) {
  .top-controls .top-field-search {
    flex: 0 1 150px;
    width: 150px;
    min-width: 130px;
    max-width: 150px;
  }
}

/* Avoid the 1251px crossover where View controls previously clipped. */
@media (min-width: 1251px) and (max-width: 1500px) {
  .top-controls {
    flex-wrap: wrap !important;
    align-content: center;
  }

  .top-controls .layout-toggle {
    flex: 0 0 auto;
  }
}

@media (min-width: 701px) and (max-width: 1000px) {
  .top-controls > .top-field-search {
    grid-column: 6 / span 3;
    grid-row: 1;
  }

  .top-controls .tag-filter-field {
    grid-column: 9 / -1;
    grid-row: 1;
  }

  .top-controls .manage-tags-button {
    grid-column: 1 / span 2;
    grid-row: 2;
  }

  .top-controls .sort-field {
    grid-column: 3 / span 3;
    grid-row: 2;
  }

  .top-controls .layout-toggle {
    grid-column: 6 / -1;
    grid-row: 2;
  }
}

@media (max-width: 700px) {
  .mobile-secondary-controls .layout-toggle {
    grid-template-columns:
      auto repeat(3, minmax(0, 1fr));
  }

  .mobile-secondary-controls #overviewViewButton::after {
    content: "Compact";
    font-size: 12px;
  }

  .mobile-secondary-controls #overviewViewButton
    .compact-card-view-icon {
    display: none;
  }

  .notes-grid.overview-view {
    grid-template-columns:
      repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .notes-grid.overview-view .note-card {
    min-height: 92px !important;
    padding: 8px !important;
  }

  .notes-grid.overview-view .note-card h3 {
    padding-right: 24px;
    font-size: 11px;
  }

  .notes-grid.overview-view .card-preview {
    font-size: 9px;
    -webkit-line-clamp: 4;
  }
}

/* Final primary-toolbar packing contract. Keep this after legacy responsive
   layers so every tablet, desktop, maximized, and ultrawide window exposes
   the same primary actions without overlap. */
@media (min-width: 701px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    row-gap: 9px !important;
  }

  .brand {
    width: 100% !important;
    overflow: visible !important;
  }

  .top-controls {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    align-items: end !important;
    gap: 7px !important;
    width: 100% !important;
    overflow: visible !important;
  }

  .quick-save-sync-area {
    grid-column: 3 / span 2 !important;
    grid-row: 1 !important;
  }

  .top-controls > .new-note-button {
    grid-column: 5 !important;
    grid-row: 1 !important;
    width: 100% !important;
    margin: 0 !important;
  }

  .top-controls .file-menu {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  .top-controls > .task-workspace-button {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: 100% !important;
  }

  .top-controls .open-notebook-top-button {
    grid-column: 6 / span 2 !important;
    grid-row: 1 !important;
    width: 100% !important;
  }

  .top-controls .notification-button {
    grid-column: 8 !important;
    grid-row: 1 !important;
  }

  .top-controls .notebook-filter-field {
    grid-column: 9 / span 2 !important;
    grid-row: 1 !important;
  }

  .top-controls > .top-field-search {
    grid-column: 11 / -1 !important;
    grid-row: 1 !important;
    width: 100% !important;
    max-width: none !important;
  }

  .top-controls .tag-filter-field {
    grid-column: 1 / span 2 !important;
    grid-row: 2 !important;
  }

  .top-controls .manage-tags-button {
    grid-column: 3 / span 2 !important;
    grid-row: 2 !important;
    width: 100% !important;
    margin: 0 !important;
  }

  .top-controls .sort-field {
    grid-column: 5 / span 3 !important;
    grid-row: 2 !important;
  }

  .top-controls .layout-toggle {
    grid-column: 8 / -1 !important;
    grid-row: 2 !important;
    justify-content: flex-start !important;
  }

  .top-controls .top-field,
  .top-controls .control-select,
  .top-controls .search-input {
    width: 100% !important;
    min-width: 0 !important;
  }
}

@media (min-width: 1651px) {
  .top-controls .notebook-filter-field {
    width: 220px !important;
    justify-self: start;
  }

  .top-controls > .top-field-search {
    width: 240px !important;
    max-width: 240px !important;
    justify-self: start;
  }

  .top-controls .tag-filter-field {
    width: 180px !important;
    justify-self: start;
  }

  .top-controls .sort-field {
    width: 330px !important;
    justify-self: start;
  }
}

@media (min-width: 701px) and (max-width: 1000px) {
  .top-controls .file-menu {
    grid-column: 1 / span 2 !important;
    grid-row: 1 !important;
  }

  .top-controls > .task-workspace-button {
    grid-column: 3 / span 2 !important;
    grid-row: 1 !important;
  }

  .quick-save-sync-area {
    grid-column: 5 / span 3 !important;
    grid-row: 1 !important;
  }

  .top-controls > .new-note-button {
    grid-column: 8 / span 2 !important;
    grid-row: 1 !important;
  }

  .top-controls .open-notebook-top-button {
    grid-column: 10 / -1 !important;
    grid-row: 1 !important;
  }

  .top-controls .notification-button {
    grid-column: 1 !important;
    grid-row: 2 !important;
  }

  .top-controls .notebook-filter-field {
    grid-column: 2 / span 3 !important;
    grid-row: 2 !important;
  }

  .top-controls > .top-field-search {
    grid-column: 5 / span 4 !important;
    grid-row: 2 !important;
  }

  .top-controls .tag-filter-field {
    grid-column: 9 / -1 !important;
    grid-row: 2 !important;
  }

  .top-controls .manage-tags-button {
    grid-column: 1 / span 3 !important;
    grid-row: 3 !important;
  }

  .top-controls .sort-field {
    grid-column: 4 / span 3 !important;
    grid-row: 3 !important;
  }

  .top-controls .layout-toggle {
    grid-column: 7 / -1 !important;
    grid-row: 3 !important;
  }
}

@media (max-width: 700px) {
  .mobile-secondary-controls >
    .open-notebook-top-button {
    order: initial !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 36px !important;
  }
}


/* =========================================================
   Encrypted Lists and Projects
   ========================================================= */

.task-workspace-button {
  white-space: nowrap;
  width: auto !important;
  min-width: 0 !important;
  min-height: 34px !important;
  height: 34px !important;
  padding: 4px 9px !important;
  border-radius: 9px !important;
  font-size: 14px !important;
  line-height: 1 !important;
  font-weight: 800;
}

body.rnc-task-workspace-open {
  overflow: hidden;
}

.rnc-task-workspace,
.rnc-task-dialog {
  position: fixed;
  inset: 0;
  z-index: 48000;
}

.rnc-task-workspace.hidden {
  display: none;
}

.rnc-task-workspace {
  --rnc-task-control-font-size: 12px;
  background: #f7f2e8;
  color: #302d29;
  overflow: hidden;
}

.rnc-task-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.rnc-task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #d8cdbd;
  background: #fffdf9;
}

.rnc-task-header h2,
.rnc-task-header p,
.rnc-task-main-heading h3,
.rnc-task-main-heading p,
.rnc-task-dialog-heading h2,
.rnc-task-dialog-heading p {
  margin: 0;
}

.rnc-task-header h2 {
  color: #5f4421;
  font-size: clamp(1.15rem, 1.7vw, 1.55rem);
}

.rnc-task-header p,
.rnc-task-main-heading p,
.rnc-task-dialog-heading p {
  margin-top: 3px;
  color: #716a61;
}

.rnc-task-header-actions,
.rnc-task-row-actions,
.rnc-task-dialog-actions,
.rnc-task-main-heading > div:last-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.rnc-task-tool-menu {
  display: flex;
  align-items: center;
  gap: 7px;
}

.rnc-task-mobile-tools,
.rnc-task-mobile-nav-heading,
.rnc-task-mobile-browse,
.rnc-task-nav-backdrop,
.rnc-task-more {
  display: none;
}

.rnc-task-update-widget {
  min-height: 32px !important;
  padding: 4px 8px !important;
  font-size: var(--rnc-task-control-font-size) !important;
  white-space: nowrap;
}

.rnc-task-widget-notice {
  position: fixed;
  z-index: 30;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 13px;
  border: 1px solid #78a487;
  border-radius: 10px;
  background: #edf8f0;
  color: #24673b;
  font-size: var(--rnc-task-control-font-size);
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(48, 38, 25, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.rnc-task-widget-notice.visible {
  opacity: 1;
  transform: translateY(0);
}

.rnc-task-widget-notice.error {
  border-color: #c68b83;
  background: #fff1ef;
  color: #8c342b;
}

.rnc-task-header button,
.rnc-task-main button,
.rnc-task-sidebar button,
.rnc-task-dialog button,
.rnc-task-dialog input,
.rnc-task-dialog select,
.rnc-task-dialog textarea,
.rnc-task-quick-add input {
  min-height: 38px;
  font: inherit;
}

.rnc-task-dialog button,
.rnc-task-dialog input,
.rnc-task-dialog select,
.rnc-task-dialog textarea {
  min-height: 44px;
  font: inherit;
}

.rnc-task-header button,
.rnc-task-main button,
.rnc-task-sidebar button,
.rnc-task-dialog button {
  border: 1px solid #cfc3b3;
  border-radius: 10px;
  background: #fffdf9;
  color: #332f2a;
  padding: 6px 10px;
  font-weight: 750;
  cursor: pointer;
}

.rnc-task-header button:hover,
.rnc-task-main button:hover,
.rnc-task-sidebar button:hover,
.rnc-task-dialog button:hover {
  border-color: #8b6f47;
  background: #f8f0e3;
}

.rnc-task-header .rnc-task-close {
  width: 40px;
  padding: 0;
  font-size: 1.35rem;
}

.rnc-task-layout {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.rnc-task-sidebar {
  min-height: 0;
  overflow: auto;
  padding: 10px 9px 24px;
  border-right: 1px solid #d8cdbd;
  background: #f1e8da;
}

.rnc-task-smart-views {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
}

.rnc-task-sidebar section + section {
  margin-top: 12px;
}

.rnc-task-sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 5px 6px 10px;
  color: #665138;
}

.rnc-task-sidebar-heading button {
  width: 36px;
  padding: 0;
  font-size: 1.1rem;
}

.rnc-task-sidebar [data-task-list-nav] {
  display: grid;
  gap: 4px;
}

.rnc-task-sidebar nav button,
.rnc-task-sidebar [data-task-list-nav] button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border-color: transparent;
  background: transparent;
  text-align: left;
}

.rnc-task-sidebar button.active {
  background: #fffdf9;
  border-color: #a98a5d;
  box-shadow: 0 1px 4px rgba(72, 52, 28, 0.1);
  color: #64440e;
}

.rnc-task-main {
  min-width: 0;
  overflow: auto;
  padding: 14px clamp(12px, 2vw, 28px) 60px;
}

.rnc-task-main-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.rnc-task-main-heading h3 {
  color: #4f3718;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.rnc-task-add-button {
  width: 38px;
  min-width: 38px;
  padding: 0 !important;
  font-size: 1.25rem !important;
  line-height: 1 !important;
}

.rnc-task-quick-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  margin-bottom: 10px;
}

.rnc-task-quick-add.hidden {
  display: none;
}

.rnc-task-quick-add input,
.rnc-task-dialog input,
.rnc-task-dialog select,
.rnc-task-dialog textarea {
  width: 100%;
  border: 1px solid #c9bdad;
  border-radius: 10px;
  background: #fff;
  color: #2f2c29;
  padding: 9px 11px;
}

.rnc-task-quick-add input:focus,
.rnc-task-dialog input:focus,
.rnc-task-dialog select:focus,
.rnc-task-dialog textarea:focus {
  outline: 3px solid rgba(173, 123, 46, 0.25);
  border-color: #936616;
}

.rnc-task-items {
  display: grid;
  gap: 5px;
}

.rnc-task-row {
  display: grid;
  grid-template-columns: 20px 36px minmax(0, 1fr) 30px auto;
  align-items: center;
  gap: 7px;
  margin-left: calc(var(--task-depth, 0) * min(30px, 4vw));
  padding: 6px 8px;
  border: 1px solid #ded4c5;
  border-left: calc(3px + min(var(--task-depth, 0), 1) * 2px) solid #9a7f5b;
  border-radius: 12px;
  background: #fffdf9;
  box-shadow: 0 1px 3px rgba(65, 46, 23, 0.06);
}

.rnc-task-drag-handle {
  width: 30px;
  min-width: 30px;
  min-height: 32px !important;
  padding: 0 !important;
  border-color: transparent !important;
  background: transparent !important;
  color: #75644f !important;
  cursor: grab !important;
  touch-action: none;
  font-size: 18px !important;
  line-height: 1 !important;
}

.rnc-task-dragging {
  opacity: 0.48;
}

.rnc-task-dragging .rnc-task-drag-handle {
  cursor: grabbing !important;
}

.rnc-task-row.rnc-task-drop-before {
  box-shadow: inset 0 4px 0 #8a641f;
}

.rnc-task-row.rnc-task-drop-after {
  box-shadow: inset 0 -4px 0 #8a641f;
}

.rnc-task-row.rnc-task-drop-inside,
.rnc-task-sidebar [data-task-list-nav] button.rnc-task-list-drop,
.rnc-task-items.rnc-task-list-drop {
  border-color: #936616;
  background: #fff0c9;
  box-shadow: inset 0 0 0 2px rgba(147, 102, 22, 0.24);
}

.rnc-task-select {
  width: 17px;
  height: 17px;
  accent-color: #765c38;
}

.rnc-task-complete {
  width: 34px;
  min-height: 34px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 1rem;
}

.rnc-task-complete.complete {
  background: #dcebdd;
  border-color: #5f8662;
  color: #245f36;
}

.rnc-task-content {
  min-width: 0;
}

.rnc-task-title {
  display: block;
  flex: 1;
  width: 100%;
  min-height: auto !important;
  padding: 2px 0 !important;
  border: 0 !important;
  background: transparent !important;
  text-align: left;
  font-size: 15px !important;
  line-height: 1.22 !important;
}

.rnc-task-title-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.rnc-task-collapse,
.rnc-task-collapse-spacer {
  flex: 0 0 24px;
  width: 24px;
  min-width: 24px;
}

.rnc-task-collapse {
  min-height: 24px !important;
  padding: 0 !important;
  border-color: transparent !important;
  background: transparent !important;
  color: #62430f !important;
  font-size: 16px !important;
  line-height: 1 !important;
}

.rnc-task-tree-toggle {
  min-height: 30px !important;
  padding: 3px 7px !important;
  font-size: 11px !important;
  white-space: nowrap;
}

.rnc-task-title.complete {
  color: #77716a !important;
  text-decoration: line-through;
}

.rnc-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
  margin-top: 2px;
  color: #716a61;
  font-size: 12px;
}

.rnc-task-meta span {
  overflow-wrap: anywhere;
}

.rnc-task-meta button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #73500c;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

.rnc-task-meta .blocked {
  color: #9c2f2f;
  font-weight: 800;
}

.rnc-task-meta .ready {
  color: #24673b;
  font-weight: 800;
}

.rnc-task-row-actions {
  justify-content: flex-end;
}

.rnc-task-row-actions button {
  min-height: 32px;
  padding: 4px 7px;
  font-size: var(--rnc-task-control-font-size);
}

/* Keep every visible boxed task control at the same compact text scale. */
.rnc-task-tool-menu button,
.rnc-task-main-heading > div:last-child button,
.rnc-task-quick-add button {
  min-height: 32px;
  padding: 4px 7px;
  font-size: var(--rnc-task-control-font-size);
}

.rnc-task-tree-toggle {
  font-size: var(--rnc-task-control-font-size) !important;
}

.rnc-task-empty {
  padding: 34px 20px;
  border: 1px dashed #c7b8a4;
  border-radius: 12px;
  background: rgba(255, 253, 249, 0.65);
  color: #625b52;
  text-align: center;
}

.rnc-task-empty p {
  margin: 6px 0 0;
}

.rnc-task-dialog {
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 50000;
}

.rnc-task-dialog-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(44, 40, 34, 0.65) !important;
}

.rnc-task-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
  padding: 22px;
  border: 2px solid #a97a2d;
  border-radius: 18px;
  background: #fffdf9;
  box-shadow: 0 22px 70px rgba(34, 28, 20, 0.35);
  overscroll-behavior: contain;
}

.rnc-task-name-panel {
  width: min(520px, 100%);
}

.rnc-task-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.rnc-task-dialog-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.rnc-task-dialog-heading-actions > [data-cancel] {
  min-width: 44px;
  width: 44px;
  padding: 0;
  font-size: 1.5rem;
}

.rnc-task-top-submit {
  white-space: nowrap;
}

.rnc-task-fullscreen-toggle {
  white-space: nowrap;
}

.rnc-task-dialog.rnc-task-editor-fullscreen {
  align-items: stretch;
  padding: 0;
}

.rnc-task-dialog.rnc-task-editor-fullscreen
  .rnc-task-editor-panel {
  width: 100%;
  max-width: none;
  height: var(--rnc-mobile-vv-height, 100dvh);
  max-height: var(--rnc-mobile-vv-height, 100dvh);
  border: 0;
  border-radius: 0;
}

.rnc-task-dialog.rnc-task-editor-fullscreen
  .rnc-task-editor-panel
  .rnc-task-dialog-heading {
  position: sticky;
  z-index: 3;
  top: 0;
  padding-bottom: 7px;
  background: #fffdf9;
}

.rnc-task-dialog-panel > label,
.rnc-task-editor-panel label {
  display: grid;
  gap: 6px;
  align-content: start;
  grid-auto-rows: max-content;
  margin-bottom: 13px;
  color: #534a3f;
  font-weight: 750;
}

.rnc-task-dialog-panel textarea {
  min-height: 100px;
  resize: vertical;
}

.rnc-task-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 0 14px;
}

.rnc-task-form-grid > *,
.rnc-task-editor-panel label,
.rnc-task-editor-panel input,
.rnc-task-editor-panel select,
.rnc-task-editor-panel textarea {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.rnc-task-editor-panel input[type="datetime-local"] {
  width: 100%;
  min-inline-size: 0;
}

.rnc-task-form-grid > label > input,
.rnc-task-form-grid > label > select {
  min-height: 48px;
}

.rnc-task-editor-panel [data-reminder-delivery-status] {
  overflow-wrap: anywhere;
  color: #6e665c;
  font-weight: 550;
  line-height: 1.3;
}

.rnc-task-editor-panel [data-open-alert-setup] {
  min-height: 28px;
  margin-top: 5px;
  padding: 2px 7px;
  font-size: 12px;
}

.rnc-task-check-label {
  display: flex !important;
  grid-column: 1 / -1;
  align-items: center;
  gap: 9px !important;
}

.rnc-task-check-label input {
  width: 22px !important;
  min-height: 22px !important;
}

.rnc-task-dependencies {
  margin: 5px 0 16px;
  padding: 12px;
  border: 1px solid #d5c9b8;
  border-radius: 12px;
}

.rnc-task-dependencies legend {
  padding: 0 5px;
  color: #62430f;
  font-weight: 850;
}

.rnc-task-dependencies [data-dependency-options] {
  display: grid;
  gap: 7px;
  max-height: 220px;
  overflow: auto;
}

.rnc-task-linked-notes {
  margin: 5px 0 16px;
  padding: 12px;
  border: 1px solid #d5c9b8;
  border-radius: 12px;
}

.rnc-task-linked-notes legend {
  padding: 0 5px;
  color: #62430f;
  font-weight: 850;
}

.rnc-task-linked-notes [data-linked-note-options] {
  display: grid;
  gap: 7px;
  max-height: 220px;
  overflow: auto;
}

.rnc-task-choice-picker > summary {
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #cbbda9;
  border-radius: 10px;
  background: #fffdf9;
  color: #534a3f;
  font-weight: 800;
  cursor: pointer;
  box-sizing: border-box;
}

.rnc-task-choice-picker[open] > summary {
  margin-bottom: 10px;
}

.rnc-task-choice-picker > p {
  margin: 0 0 10px;
  color: #6e665c;
}

.rnc-task-choice-search {
  width: 100%;
  min-height: 36px !important;
  margin: 0 0 10px !important;
  padding: 7px 10px !important;
  border: 1px solid #cbbda9 !important;
  border-radius: 9px !important;
  background: #fff !important;
  color: #302c27 !important;
  font: inherit;
  font-size: 14px !important;
  box-sizing: border-box;
}

.rnc-task-choice-search:focus {
  border-color: #8d7653 !important;
  outline: 2px solid rgba(141, 118, 83, 0.2);
  outline-offset: 1px;
}

.rnc-task-choice-empty {
  padding: 6px 2px;
  color: #6e665c;
  font-style: italic;
}

.rnc-task-dependencies [data-choice-search-text][hidden],
.rnc-task-linked-notes [data-choice-search-text][hidden] {
  display: none !important;
}

.rnc-task-selected-choices {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}

.rnc-task-selected-choices[hidden] {
  display: none;
}

.rnc-task-selected-choice {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid #d5c9b8;
  border-radius: 10px;
  background: #fffdf9;
  color: #534a3f;
  font-weight: 750;
}

.rnc-task-selected-linked-note {
  grid-template-columns: 24px minmax(0, 1fr) auto;
}

.rnc-task-selected-check {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 4px;
  background: #1677e8;
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.rnc-task-selected-choice > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rnc-task-linked-note-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.rnc-task-linked-note-option label {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  min-width: 0;
  margin: 0 !important;
}

.rnc-task-linked-note-option input {
  width: 20px !important;
  min-height: 20px !important;
}

.rnc-task-linked-note-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rnc-task-dependencies label {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-weight: 550;
}

.rnc-task-dependencies input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
}

.rnc-task-dialog-status {
  min-height: 1.4em;
  margin: 9px 0;
  color: #27613a;
  font-weight: 750;
}

.rnc-task-dialog-status.error {
  color: #a52c2c;
}

.rnc-task-dialog-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.rnc-task-reminder-popup {
  position: fixed;
  z-index: 52000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(44, 40, 34, 0.65);
}

.rnc-task-reminder-panel {
  width: min(480px, 100%);
  padding: 22px;
  border: 2px solid #a97a2d;
  border-radius: 18px;
  background: #fffdf9;
  box-shadow: 0 22px 70px rgba(34, 28, 20, 0.35);
}

.rnc-task-reminder-panel h2,
.rnc-task-reminder-panel p {
  margin: 6px 0;
}

.rnc-task-reminder-label {
  color: #80550f;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.rnc-task-template-list {
  display: grid;
  gap: 10px;
}

.rnc-task-template-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px;
  border: 1px solid #ddd2c3;
  border-radius: 12px;
}

.rnc-task-template-row > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.rnc-task-template-row span {
  color: #736b62;
}

.rnc-task-export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rnc-task-export-actions button {
  display: grid;
  gap: 3px;
  min-height: 70px;
  text-align: left;
}

.rnc-task-export-actions span {
  color: #736b62;
  font-size: 0.85rem;
  font-weight: 500;
}

.rnc-task-export-warning {
  padding: 10px;
  border-radius: 10px;
  background: #fff3c8;
  color: #57471e;
}

.rnc-task-alert-setup-panel {
  width: min(600px, 100%);
}

.rnc-task-alert-setup-panel > p {
  color: #5f5850;
  line-height: 1.45;
}

.rnc-task-alert-setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.rnc-task-alert-test-result {
  min-height: 1.5em;
  padding: 9px 10px;
  border-radius: 10px;
  background: #f3eee6;
  color: #5f5850;
  font-weight: 750;
}

.rnc-task-alert-test-result:empty {
  display: none;
}

.rnc-task-alert-test-result.success {
  background: #e3f3e5;
  color: #24673b;
}

.rnc-task-alert-test-result.error {
  background: #fbe6e3;
  color: #9c2f2f;
}

.rnc-task-print-frame {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.rnc-task-undo {
  position: fixed;
  z-index: 49000;
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(620px, calc(100% - 32px));
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid #9c7a49;
  border-radius: 12px;
  background: #fff8df;
  color: #4e3a1f;
  box-shadow: 0 12px 35px rgba(45, 34, 20, .24);
  font-weight: 750;
}

.rnc-task-undo.hidden {
  display: none;
}

.rnc-task-undo button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid #76552a;
  border-radius: 9px;
  background: #76552a;
  color: white;
  font: inherit;
  font-weight: 800;
}

/* iPad and other compact screens need the task sheet to follow the visual
   viewport when an on-screen keyboard reduces the usable height. */
@media (max-width: 1100px) {
  .rnc-task-dialog {
    top: var(--rnc-mobile-vv-top, 0px);
    bottom: auto;
    height: var(--rnc-mobile-vv-height, 100dvh);
    max-height: var(--rnc-mobile-vv-height, 100dvh);
    align-items: end;
    padding: 8px;
    overflow: hidden;
  }

  .rnc-task-dialog-panel {
    width: min(720px, 100%);
    max-height: calc(var(--rnc-mobile-vv-height, 100dvh) - 16px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-padding: 76px 0 120px;
  }

  .rnc-task-editor-panel .rnc-task-dialog-actions {
    position: sticky;
    z-index: 2;
    bottom: -22px;
    margin: 12px -22px -22px;
    padding: 10px 22px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid #ded4c5;
    background: #fffdf9;
  }

  .rnc-task-form-grid,
  .rnc-task-export-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .rnc-task-header {
    align-items: flex-start;
  }

  .rnc-task-header-actions {
    position: relative;
    justify-content: flex-end;
  }

  .rnc-task-mobile-tools {
    display: block;
  }

  .rnc-task-tool-menu {
    position: absolute;
    z-index: 6;
    top: calc(100% + 5px);
    right: 0;
    display: none;
    width: min(230px, 82vw);
    padding: 7px;
    border: 1px solid #cfc3b3;
    border-radius: 10px;
    background: #fffdf9;
    box-shadow: 0 12px 30px rgba(48, 38, 25, 0.22);
  }

  .rnc-task-header-actions.tools-open .rnc-task-tool-menu {
    display: grid;
    gap: 5px;
  }

  .rnc-task-tool-menu button {
    width: 100%;
    text-align: left;
  }

  .rnc-task-layout {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .rnc-task-row {
    grid-template-columns: 20px 36px minmax(0, 1fr) 30px 34px;
  }

  .rnc-task-more {
    display: block;
    width: 34px;
    min-height: 34px !important;
    padding: 0 !important;
    font-size: 1.1rem !important;
  }

  .rnc-task-row-actions {
    display: none;
    grid-column: 3 / -1;
    justify-content: flex-start;
  }

  .rnc-task-row.actions-open .rnc-task-row-actions {
    display: flex;
  }
}

@media (max-width: 700px) {
  .private-status-bar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .private-status-bar span {
    flex-basis: 100%;
  }

  .private-status-bar button {
    min-height: 30px;
    padding: 3px 8px;
    font-size: 12px;
  }

  .rnc-task-top-submit {
    display: none !important;
  }

  .rnc-task-header {
    position: relative;
    display: flex;
    min-height: 48px;
    padding: 6px 8px 6px 10px;
  }

  .rnc-task-header h2 {
    font-size: 19px;
  }

  .rnc-task-header p {
    display: none;
  }

  .rnc-task-header-actions {
    position: relative;
    display: flex;
    width: auto;
    margin-left: auto;
  }

  .rnc-task-header-actions button {
    min-width: 0;
    min-height: 32px;
    padding: 4px 7px;
    font-size: var(--rnc-task-control-font-size);
  }

  .rnc-task-layout {
    position: relative;
    display: block;
    overflow: hidden;
  }

  .rnc-task-sidebar {
    position: absolute;
    z-index: 5;
    inset: 0 auto 0 0;
    width: min(330px, 88vw);
    max-height: none;
    padding: 8px 9px 24px;
    border-right: 1px solid #c9bca9;
    transform: translateX(-105%);
    transition: transform 160ms ease-out;
    box-shadow: none;
  }

  .rnc-task-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 10px 0 28px rgba(47, 37, 25, 0.25);
  }

  .rnc-task-mobile-nav-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 2px 7px 7px;
    color: #5f4421;
  }

  .rnc-task-mobile-nav-heading button {
    min-height: 34px;
    padding: 3px 9px;
  }

  .rnc-task-nav-backdrop {
    position: absolute;
    z-index: 4;
    inset: 0;
    display: none;
    width: 100%;
    height: 100%;
    border: 0 !important;
    border-radius: 0 !important;
    background: rgba(47, 42, 35, 0.42) !important;
  }

  .rnc-task-nav-backdrop.mobile-open {
    display: block;
  }

  .rnc-task-smart-views {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    margin-bottom: 7px;
    padding-bottom: 2px;
  }

  .rnc-task-smart-views button {
    min-width: 0;
    min-height: 36px;
    padding: 4px 7px;
    font-size: 13px;
  }

  .rnc-task-sidebar section {
    margin-top: 8px !important;
  }

  .rnc-task-sidebar [data-task-list-nav] {
    display: flex;
    overflow-x: auto;
  }

  .rnc-task-sidebar [data-task-list-nav] button {
    flex: 0 0 auto;
    width: auto;
    gap: 12px;
    min-height: 36px;
    padding: 4px 8px;
    font-size: 13px;
  }

  .rnc-task-main {
    width: 100%;
    height: 100%;
    padding: 8px 7px calc(24px + env(safe-area-inset-bottom));
  }

  .rnc-task-main-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
  }

  .rnc-task-main-heading > div:first-child {
    min-width: 0;
    flex: 1;
  }

  .rnc-task-main-heading h3 {
    font-size: 18px;
    line-height: 1.15;
  }

  .rnc-task-main-heading p {
    margin-top: 1px;
    font-size: 12px;
  }

  .rnc-task-mobile-browse {
    display: inline-block;
    min-height: 32px !important;
    margin: 0 0 4px;
    padding: 3px 7px !important;
    font-size: 12px !important;
  }

  .rnc-task-main-heading > div:last-child {
    gap: 4px;
    justify-content: flex-end;
  }

  .rnc-task-main-heading > div:last-child button {
    min-height: 30px;
    padding: 3px 6px;
    font-size: var(--rnc-task-control-font-size);
  }

  .rnc-task-quick-add {
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 5px;
    margin-bottom: 6px;
  }

  .rnc-task-quick-add input {
    min-height: 38px;
    padding: 6px 8px;
    font-size: 14px;
  }

  .rnc-task-quick-add button {
    width: 40px;
    min-height: 38px;
    padding: 0 !important;
    overflow: hidden;
    font-size: 0 !important;
  }

  .rnc-task-quick-add button::before {
    content: "+";
    font-size: 20px;
  }

  .rnc-task-row {
    grid-template-columns: 34px minmax(0, 1fr) 28px 32px;
    gap: 6px;
    margin-left: calc(var(--task-depth, 0) * 12px);
    padding: 5px 6px;
    border-radius: 9px;
  }

  .rnc-task-drag-handle {
    width: 28px;
    min-width: 28px;
  }

  .rnc-task-select {
    display: none;
  }

  .rnc-task-complete {
    grid-column: 1;
    width: 32px;
    min-height: 32px !important;
  }

  .rnc-task-content {
    grid-column: 2;
  }

  .rnc-task-drag-handle {
    grid-column: 3;
  }

  .rnc-task-title {
    font-size: 15px !important;
  }

  .rnc-task-more {
    grid-column: 4;
    width: 32px;
    min-height: 32px !important;
  }

  .rnc-task-meta {
    font-size: 11px;
  }

  .rnc-task-row-actions {
    display: none;
    grid-column: 2 / -1;
    grid-template-columns: repeat(5, minmax(0, auto));
    width: 100%;
    overflow: visible;
  }

  .rnc-task-row.actions-open .rnc-task-row-actions {
    display: grid;
  }

  .rnc-task-row-actions button {
    min-width: 0;
    min-height: 30px;
    padding: 3px 6px;
    font-size: var(--rnc-task-control-font-size);
  }

  .rnc-task-collapse,
  .rnc-task-collapse-spacer {
    flex-basis: 22px;
    width: 22px;
    min-width: 22px;
  }

  .rnc-task-tree-toggle {
    min-height: 28px !important;
    padding: 2px 5px !important;
    font-size: var(--rnc-task-control-font-size) !important;
  }

  .rnc-task-undo {
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    width: calc(100% - 16px);
    padding: 8px 10px;
    font-size: 13px;
  }

  .rnc-task-dialog {
    top: var(--rnc-mobile-vv-top, 0px);
    bottom: auto;
    height: var(--rnc-mobile-vv-height, 100dvh);
    max-height: var(--rnc-mobile-vv-height, 100dvh);
    align-items: end;
    padding: 0;
    overflow: hidden;
  }

  .rnc-task-dialog-panel {
    width: 100%;
    max-height: calc(var(--rnc-mobile-vv-height, 100dvh) - 6px);
    padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
    border-width: 2px 0 0;
    border-radius: 18px 18px 0 0;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: 84px;
  }

  .rnc-task-editor-panel .rnc-task-dialog-actions {
    position: sticky;
    z-index: 2;
    bottom: calc(-18px - env(safe-area-inset-bottom));
    margin: 12px -14px calc(-18px - env(safe-area-inset-bottom));
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid #ded4c5;
    background: #fffdf9;
  }

  .rnc-task-reminder-popup {
    top: var(--rnc-mobile-vv-top, 0px);
    bottom: auto;
    height: var(--rnc-mobile-vv-height, 100dvh);
    padding: 10px;
  }

  .rnc-task-form-grid,
  .rnc-task-export-actions {
    grid-template-columns: 1fr;
  }

  .rnc-task-template-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .rnc-task-header h2 {
    font-size: 18px;
  }

  .rnc-task-main-heading > div:last-child button {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rnc-task-row-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* =========================================================
   Final brand lockup and top-control sizing contract
   ========================================================= */

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  display: grid;
  gap: 1px;
  margin: 0;
  overflow: visible;
  line-height: 1.05 !important;
  white-space: nowrap;
}

.brand-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.015em;
}

.brand-product {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.brand-product #mainRncBuild {
  margin-left: 3px;
  color: #746a5c;
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}

@media (min-width: 701px) {
  .brand-copy h1 {
    font-size: inherit !important;
  }

  .top-controls {
    --top-control-height: 34px;
    --top-action-width: 104px;
  }

  .top-controls .file-menu,
  .top-controls > .task-workspace-button,
  .top-controls .quick-save-sync-area,
  .top-controls > .new-note-button,
  .top-controls .open-notebook-top-button,
  .top-controls .manage-tags-button {
    width: min(var(--top-action-width), 100%) !important;
    min-width: 0 !important;
    justify-self: start;
  }

  .top-controls .file-menu-button,
  .top-controls > .task-workspace-button,
  .top-controls .quick-save-sync-button,
  .top-controls > .new-note-button,
  .top-controls .open-notebook-top-button,
  .top-controls .manage-tags-button,
  .top-controls .control-select,
  .top-controls .search-input,
  .top-controls .notification-button,
  .top-controls .layout-button,
  .top-controls .view-button {
    box-sizing: border-box;
    height: var(--top-control-height) !important;
    min-height: var(--top-control-height) !important;
    max-height: var(--top-control-height) !important;
    border-radius: 10px !important;
    font-size: 11px !important;
    line-height: 1 !important;
  }

  .top-controls .file-menu-button,
  .top-controls > .task-workspace-button,
  .top-controls .quick-save-sync-button,
  .top-controls > .new-note-button,
  .top-controls .open-notebook-top-button,
  .top-controls .manage-tags-button {
    width: 100% !important;
    padding: 0 10px !important;
    white-space: nowrap;
  }

  .top-controls .notification-button,
  .top-controls .layout-button,
  .top-controls .view-button {
    width: var(--top-control-height) !important;
    min-width: var(--top-control-height) !important;
    padding: 0 !important;
  }

  .top-controls .control-select,
  .top-controls .search-input {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .top-controls .layout-toggle {
    display: grid !important;
    grid-template-columns:
      repeat(6, var(--top-control-height));
    align-items: end;
    gap: 4px !important;
  }

  .top-controls .layout-button,
  .top-controls .view-button {
    display: grid !important;
    place-items: center;
    margin: 0 !important;
    border: 0 !important;
    font-size: 14px !important;
  }

  .top-controls .compact-card-view-icon {
    grid-template-columns: repeat(3, 4px);
    grid-template-rows: repeat(2, 4px);
    gap: 1px;
    width: 14px;
    height: 9px;
  }
}

@media (max-width: 700px) {
  #quickSaveSyncStatus:not(:empty) {
    position: fixed;
    z-index: 25000;
    top: calc(10px + env(safe-area-inset-top));
    right: 10px;
    left: 10px;
    width: auto;
    max-width: 440px;
    margin: 0 auto;
    font-size: 11px;
  }

  .mobile-note-location-control {
    position: relative;
    display: grid;
    grid-template-columns: 20px 8px;
    place-content: center;
    align-items: center;
    width: 44px;
    min-width: 44px;
    height: 40px;
    overflow: hidden;
    border: 1px solid rgba(120, 110, 98, .22);
    border-radius: 8px;
    background: rgba(255, 255, 255, .72);
    color: #65533f;
  }

  .mobile-note-location-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
  }

  .mobile-note-location-arrow {
    font-size: 9px;
    line-height: 1;
  }

  #mobileNoteLocationSelect {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
  }

  .brand-copy h1 {
    gap: 0;
    font-size: inherit !important;
    text-overflow: clip;
  }

  .brand-name {
    font-size: 12px;
  }

  .brand-product {
    font-size: 10.5px;
  }

  .brand-product #mainRncBuild {
    font-size: 8.5px;
  }
}

/* =========================================================
   Lists & Projects desktop/tablet density contract
   ========================================================= */

@media (min-width: 701px) {
  .rnc-task-workspace {
    --rnc-task-control-font-size: 11px;
    font-size: 13px;
  }

  .rnc-task-header {
    gap: 9px;
    padding: 7px 10px;
  }

  .rnc-task-header h2 {
    font-size: 18px;
    line-height: 1.1;
  }

  .rnc-task-header p {
    margin-top: 2px;
    font-size: 12px;
  }

  .rnc-task-header-actions,
  .rnc-task-tool-menu,
  .rnc-task-main-heading > div:last-child {
    gap: 5px;
  }

  .rnc-task-header button,
  .rnc-task-main-heading > div:last-child button,
  .rnc-task-quick-add button {
    min-height: 30px;
    padding: 3px 7px;
    border-radius: 9px;
    font-size: var(--rnc-task-control-font-size);
  }

  .rnc-task-header .rnc-task-close {
    width: 32px;
    min-width: 32px;
    padding: 0;
    font-size: 18px;
  }

  .rnc-task-update-widget {
    min-height: 30px !important;
    padding: 3px 7px !important;
  }

  .rnc-task-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .rnc-task-sidebar {
    padding: 7px 7px 18px;
  }

  .rnc-task-smart-views {
    gap: 3px;
    margin-bottom: 9px;
  }

  .rnc-task-sidebar section + section {
    margin-top: 9px;
  }

  .rnc-task-sidebar-heading {
    gap: 7px;
    padding: 0 4px 4px 7px;
    font-size: 12px;
  }

  .rnc-task-sidebar-heading button {
    width: 30px;
    min-height: 30px;
    padding: 0;
    font-size: 16px;
  }

  .rnc-task-sidebar [data-task-list-nav] {
    gap: 2px;
  }

  .rnc-task-sidebar nav button,
  .rnc-task-sidebar [data-task-list-nav] button {
    min-height: 30px;
    padding: 4px 7px;
    border-radius: 9px;
    font-size: 13px;
  }

  .rnc-task-main {
    padding: 10px 14px 42px;
  }

  .rnc-task-main-heading {
    gap: 10px;
    margin-bottom: 7px;
  }

  .rnc-task-main-heading h3 {
    font-size: 19px;
    line-height: 1.1;
  }

  .rnc-task-main-heading p {
    margin-top: 2px;
    font-size: 12px;
  }

  .rnc-task-add-button {
    width: 32px;
    min-width: 32px;
    font-size: 17px !important;
  }

  .rnc-task-quick-add {
    gap: 5px;
    margin-bottom: 7px;
  }

  .rnc-task-quick-add input {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 13px;
  }

  .rnc-task-items {
    gap: 4px;
  }

  .rnc-task-row {
    grid-template-columns:
      16px 28px minmax(0, 1fr) 24px auto;
    gap: 5px;
    margin-left: calc(
      var(--task-depth, 0) * min(22px, 3vw)
    );
    padding: 4px 6px;
    border-radius: 9px;
  }

  .rnc-task-select {
    width: 15px;
    height: 15px;
  }

  .rnc-task-complete {
    width: 28px;
    min-height: 28px !important;
    font-size: 13px;
  }

  .rnc-task-title {
    padding: 1px 0 !important;
    font-size: 13px !important;
    line-height: 1.15 !important;
  }

  .rnc-task-title-line {
    gap: 3px;
  }

  .rnc-task-collapse,
  .rnc-task-collapse-spacer {
    flex-basis: 18px;
    width: 18px;
    min-width: 18px;
  }

  .rnc-task-collapse {
    min-height: 18px !important;
    font-size: 12px !important;
  }

  .rnc-task-meta {
    gap: 2px 6px;
    margin-top: 1px;
    font-size: 10.5px;
    line-height: 1.15;
  }

  .rnc-task-drag-handle {
    width: 24px;
    min-width: 24px;
    min-height: 28px !important;
    font-size: 15px !important;
  }

  .rnc-task-row-actions {
    gap: 4px;
  }

  .rnc-task-row-actions button {
    min-height: 28px;
    padding: 3px 6px;
    border-radius: 8px;
    font-size: var(--rnc-task-control-font-size);
  }

  .rnc-task-tree-toggle {
    min-height: 26px !important;
    padding: 2px 5px !important;
    font-size: 10px !important;
  }
}

@media (min-width: 701px) and (max-width: 900px) {
  .rnc-task-layout {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .rnc-task-row {
    grid-template-columns:
      16px 28px minmax(0, 1fr) 24px 30px;
  }

  .rnc-task-more {
    width: 30px;
    min-height: 28px !important;
    font-size: 15px !important;
  }
}

/* =========================================================
   Option 5: responsive unified action dock
   ========================================================= */

@media (min-width: 701px) {
  .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "brand primary"
      "dock dock";
    align-items: center !important;
    gap: 10px 14px !important;
    padding: 10px 14px 12px !important;
  }

  .topbar > .brand {
    grid-area: brand;
    width: auto !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  .top-primary-actions {
    grid-area: primary;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
  }

  .top-primary-actions .quick-save-sync-area,
  .top-primary-actions .open-notebook-top-button {
    width: 104px;
    min-width: 104px;
  }

  .top-primary-actions .quick-save-sync-button,
  .top-primary-actions .open-notebook-top-button {
    width: 100%;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 10px !important;
    border-radius: 10px !important;
    font-size: 12px !important;
  }

  .top-primary-actions .notification-button {
    width: 40px !important;
    min-width: 40px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    border-radius: 10px !important;
  }

  .topbar > .top-controls {
    grid-area: dock;
    display: grid !important;
    align-items: end !important;
    gap: 10px clamp(6px, 0.55vw, 8px) !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: clamp(10px, 0.9vw, 14px) !important;
    overflow: visible !important;
    border: 1px solid rgba(122, 101, 71, 0.22);
    border-radius: 16px;
    background: rgba(255, 253, 249, 0.76);
    box-shadow: 0 5px 18px rgba(84, 66, 42, 0.06);
  }

  .top-controls .mobile-secondary-controls {
    display: contents !important;
  }

  .top-controls .mobile-controls-button,
  .top-controls .mobile-quick-sort,
  .top-controls .mobile-controls-heading {
    display: none !important;
  }

  .top-controls .file-menu {
    grid-area: menu !important;
  }

  .top-controls > .task-workspace-button {
    grid-area: lists !important;
  }

  .top-controls > .new-note-button {
    grid-area: note !important;
  }

  .top-controls .notebook-filter-field {
    grid-area: cabinet !important;
  }

  .top-controls > .top-field-search {
    grid-area: search !important;
  }

  .top-controls .tag-filter-field {
    grid-area: tags !important;
  }

  .top-controls .manage-tags-button {
    grid-area: manage !important;
  }

  .top-controls .sort-field {
    grid-area: sort !important;
  }

  .top-controls .layout-toggle {
    grid-area: view !important;
  }

  .top-controls .file-menu,
  .top-controls > .task-workspace-button,
  .top-controls > .new-note-button,
  .top-controls .manage-tags-button,
  .top-controls .top-field,
  .top-controls .layout-toggle {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  .top-controls .file-menu-button,
  .top-controls > .task-workspace-button,
  .top-controls > .new-note-button,
  .top-controls .manage-tags-button,
  .top-controls .search-input,
  .top-controls .control-select {
    width: 100% !important;
    min-width: 0 !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 10px !important;
    border-radius: 10px !important;
    font-size: 12px !important;
  }

  .top-controls .layout-toggle {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(20px, 1fr));
    align-items: center;
    gap: 4px !important;
  }

  .top-controls .layout-button {
    width: 100% !important;
    min-width: 0 !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    border-radius: 10px !important;
  }
}

@media (min-width: 1100px) {
  .topbar > .top-controls {
    grid-template-columns:
      minmax(72px, 0.56fr)
      minmax(72px, 0.56fr)
      minmax(72px, 0.56fr)
      minmax(145px, 1.2fr)
      minmax(145px, 1.12fr)
      minmax(94px, 0.76fr)
      minmax(88px, 0.68fr)
      minmax(104px, 0.82fr)
      minmax(174px, 1.3fr) !important;
    grid-template-areas:
      "menu lists note cabinet search tags manage sort view" !important;
  }
}

@media (min-width: 701px) and (max-width: 1099px) {
  .topbar > .top-controls {
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    grid-template-areas:
      "menu menu lists lists note note search search search search search search"
      "cabinet cabinet cabinet tags tags manage manage sort sort view view view" !important;
  }
}

@media (max-width: 700px) {
  .topbar {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 8px 10px 9px !important;
  }

  .topbar > .brand {
    order: 1;
    width: 100% !important;
  }

  .top-primary-actions {
    order: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px;
    gap: 7px;
    width: 100%;
    min-width: 0;
  }

  .top-primary-actions .quick-save-sync-area,
  .top-primary-actions .open-notebook-top-button {
    width: 100% !important;
    min-width: 0 !important;
  }

  .top-primary-actions .quick-save-sync-button,
  .top-primary-actions .open-notebook-top-button {
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 8px !important;
    border-radius: 10px !important;
    font-size: 12px !important;
  }

  .top-primary-actions .notification-button {
    width: 42px !important;
    min-width: 42px !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 !important;
    border-radius: 10px !important;
  }

  .topbar > .top-controls {
    order: 3;
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
}

/* =========================================================
   RNC editor metadata control normalization
   Keep every lower-editor field compact and prevent the
   Linked Tasks summary from painting over nearby controls.
   This block intentionally remains last in the cascade.
   ========================================================= */

.editor-modal {
  --note-meta-control-height: 32px;
  --note-meta-control-font-size: 12px;
}

.note-notebook-editor select,
.note-container-editor select,
.note-tags-editor #noteTagsInput,
.note-tags-picker-button,
.note-reminder-controls input,
.compact-reminder-clear,
.note-task-links-editor button,
.note-drawing-links-editor button {
  box-sizing: border-box;
  min-height: var(--note-meta-control-height);
  height: var(--note-meta-control-height);
  max-height: var(--note-meta-control-height);
  border-radius: 8px;
  font-size: var(--note-meta-control-font-size);
  line-height: 1.2;
}

.note-notebook-editor select,
.note-container-editor select,
.note-tags-editor #noteTagsInput,
.note-reminder-controls input {
  width: 100%;
  min-width: 0;
  padding: 0 8px;
}

.note-task-links-editor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto var(--note-meta-control-height);
  grid-template-areas:
    "label label"
    "button summary";
  align-items: center;
  gap: 3px 6px;
  min-width: 0;
  overflow: hidden;
}

.note-drawing-links-editor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto var(--note-meta-control-height);
  grid-template-areas:
    "label label"
    "button summary";
  align-items: center;
  gap: 3px 6px;
  min-width: 0;
  overflow: hidden;
}

.note-drawing-links-editor .note-meta-label {
  grid-area: label;
}

#noteNewDrawingButton {
  grid-area: button;
  width: max-content;
  max-width: 100%;
  padding: 0 9px;
  white-space: nowrap;
}

.note-drawing-links-editor > span:last-child {
  grid-area: summary;
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-task-links-editor .note-meta-label {
  grid-area: label;
  margin: 0;
}

#noteTaskLinksButton {
  grid-area: button;
  width: max-content;
  max-width: 100%;
  padding: 0 9px;
  white-space: nowrap;
}

#noteTaskLinksSummary {
  grid-area: summary;
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .editor-secondary-options {
    --note-meta-control-height: 30px;
    --note-meta-control-font-size: 11px;
  }

  .editor-secondary-options .note-notebook-editor select,
  .editor-secondary-options .note-container-editor select,
  .editor-secondary-options .note-tags-editor #noteTagsInput,
  .editor-secondary-options .note-tags-picker-button,
  .editor-secondary-options .note-reminder-controls input,
  .editor-secondary-options .compact-reminder-clear,
  .editor-secondary-options .note-task-links-editor button,
  .editor-secondary-options .note-drawing-links-editor button {
    min-height: var(--note-meta-control-height) !important;
    height: var(--note-meta-control-height) !important;
    max-height: var(--note-meta-control-height) !important;
    border-radius: 8px !important;
    font-size: var(--note-meta-control-font-size) !important;
  }

  .editor-secondary-options #noteTaskLinksSummary {
    font-size: 10px;
  }
}

/* =========================================================
   RNC complete note-editor compact sizing
   Normalize the title, every formatting pull-down and button,
   lower fields, color row, and footer actions as one system.
   The writing area absorbs window-height changes so controls
   never overlap or disappear when the note window is resized.
   ========================================================= */

@media (min-width: 701px) {
  .editor-modal {
    --note-ui-control-height: 30px;
    --note-ui-control-font-size: 12px;
    --note-ui-control-radius: 7px;
    --note-meta-control-height: var(--note-ui-control-height);
    --note-meta-control-font-size: var(--note-ui-control-font-size);

    container-name: rnc-note-editor;
    container-type: inline-size;
    box-sizing: border-box;
    width: min(820px, calc(100vw - 20px));
    height: min(660px, calc(100dvh - 20px));
    max-height: calc(100dvh - 20px);
    padding: 12px;
    overflow: hidden;
  }

  .editor-modal > .note-title-row {
    flex: 0 0 auto;
    gap: 6px;
    min-width: 0;
  }

  .editor-modal .note-icon-select,
  .editor-modal .note-title-input,
  .editor-modal > .format-toolbar button,
  .editor-modal > .format-toolbar select {
    box-sizing: border-box;
    min-height: var(--note-ui-control-height);
    height: var(--note-ui-control-height);
    max-height: var(--note-ui-control-height);
    border-radius: var(--note-ui-control-radius);
    font-size: var(--note-ui-control-font-size);
    line-height: 1.15;
  }

  .editor-modal .note-icon-select {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    padding: 0 4px;
    font-size: 16px;
  }

  .editor-modal .note-title-input {
    min-width: 0;
    margin: 0;
    padding: 0 2px;
    border: 0;
    font-size: 17px;
  }

  .editor-modal > .format-toolbar {
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 3px;
    min-width: 0;
    margin: 5px 0 7px;
    padding: 5px;
    overflow-x: hidden;
    border-radius: 9px;
  }

  .editor-modal > .format-toolbar button,
  .editor-modal > .format-toolbar select {
    min-width: 0;
    padding: 0 6px;
    white-space: nowrap;
  }

  .editor-modal > .format-toolbar #fontFamily {
    width: 168px;
  }

  .editor-modal > .format-toolbar #fontSize {
    width: 92px;
  }

  .editor-modal > .format-toolbar #alignmentSelect {
    width: 84px;
  }

  .editor-modal > .format-toolbar #highlightSelect {
    width: 104px;
  }

  .editor-modal > .format-toolbar #textColorSelect {
    width: 86px;
  }

  .editor-modal > .format-toolbar #undoButton,
  .editor-modal > .format-toolbar #redoButton,
  .editor-modal > .format-toolbar [data-command],
  .editor-modal > .format-toolbar #insertChecklistButton {
    width: 30px;
    min-width: 30px;
    padding: 0;
  }

  .editor-modal > .format-toolbar #undoButton,
  .editor-modal > .format-toolbar #redoButton {
    font-size: var(--note-ui-control-font-size) !important;
  }

  .editor-modal > .format-toolbar #undoButton svg,
  .editor-modal > .format-toolbar #redoButton svg {
    width: 16px;
    height: 16px;
  }

  .editor-modal > .format-toolbar .toolbar-divider {
    height: 18px;
    margin: 0 2px;
  }

  .editor-modal > .format-toolbar .custom-color-label {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .editor-modal > .document-editor,
  .composer.editor-modal:not(.note-fullscreen)
    > .document-editor {
    flex: 1 1 60px;
    min-height: 40px;
    max-height: none;
    padding: 12px 3px 18px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .editor-modal > .editor-secondary-options {
    flex: 0 0 auto;
    min-width: 0;
  }

  .editor-modal .note-meta-strip {
    grid-template-columns:
      minmax(0, .9fr)
      minmax(0, 1.25fr)
      minmax(0, .9fr);
    gap: 6px 8px;
    margin-top: 6px;
  }

  .editor-modal .note-reminder-editor {
    grid-column: 2 / 4;
  }

  .editor-modal .composer-footer {
    flex: 0 0 auto;
    gap: 6px;
    margin: 0 -12px -12px;
    padding: 7px 12px 8px;
  }

  .editor-modal .color-picker {
    gap: 4px;
  }

  .editor-modal .color-swatch {
    width: 22px;
    height: 22px;
  }

  .editor-modal .date-toggle,
  .editor-modal .mobile-spellcheck-toggle {
    font-size: 11px;
  }

  .editor-modal .composer-actions {
    gap: 5px;
    min-width: 0;
  }

  .editor-modal .composer-actions button {
    box-sizing: border-box;
    min-height: var(--note-ui-control-height) !important;
    height: var(--note-ui-control-height) !important;
    max-height: var(--note-ui-control-height) !important;
    padding: 0 9px !important;
    border-radius: var(--note-ui-control-radius) !important;
    font-size: 11px;
    line-height: 1.15 !important;
  }
}

@container rnc-note-editor (max-width: 619px) {
  .editor-modal .note-meta-strip {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1.15fr);
  }

  .editor-modal .note-reminder-editor {
    grid-column: 1 / -1;
  }

  .editor-modal .composer-actions {
    flex-basis: 100%;
    justify-content: flex-end;
    margin-left: 0;
  }
}

@container rnc-note-editor (max-width: 570px) {
  .editor-modal .note-meta-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-modal .note-reminder-editor {
    grid-column: auto;
  }

  .editor-modal .composer-footer {
    align-items: flex-start;
  }

  .editor-modal .composer-actions {
    width: 100%;
  }
}

/* =========================================================
   RNC complete task-editor compact sizing
   Match the note editor's control, type, spacing, and resizing
   system without changing the surrounding Lists workspace.
   This block intentionally remains last in the cascade.
   ========================================================= */

@media (min-width: 701px) {
  .rnc-task-dialog:has(.rnc-task-editor-panel) {
    align-items: center;
    padding: 10px;
  }

  .rnc-task-editor-panel {
    --task-editor-control-height: 30px;
    --task-editor-control-font-size: 12px;
    --task-editor-control-radius: 7px;

    box-sizing: border-box;
    width: min(820px, calc(100vw - 20px));
    height: min(660px, calc(100dvh - 20px));
    max-height: calc(100dvh - 20px);
    padding: 12px;
    border: 2px solid #a97a2d;
    border-radius: 16px;
    font-size: var(--task-editor-control-font-size);
    overflow-x: hidden;
    overflow-y: auto;
    scroll-padding: 58px 0 54px;
  }

  .rnc-task-dialog.rnc-task-editor-fullscreen
    .rnc-task-editor-panel {
    width: 100%;
    height: var(--rnc-mobile-vv-height, 100dvh);
    max-height: var(--rnc-mobile-vv-height, 100dvh);
    border-radius: 0;
  }

  .rnc-task-editor-panel .rnc-task-dialog-heading {
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .rnc-task-editor-panel .rnc-task-dialog-heading h2 {
    font-size: 17px;
    line-height: 1.15;
  }

  .rnc-task-editor-panel .rnc-task-dialog-heading p {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.15;
  }

  .rnc-task-editor-panel .rnc-task-dialog-heading-actions {
    gap: 5px;
  }

  .rnc-task-editor-panel button,
  .rnc-task-editor-panel input,
  .rnc-task-editor-panel select {
    box-sizing: border-box;
    min-height: var(--task-editor-control-height) !important;
    height: var(--task-editor-control-height) !important;
    max-height: var(--task-editor-control-height) !important;
    padding: 0 8px;
    border-radius: var(--task-editor-control-radius);
    font-size: var(--task-editor-control-font-size);
    line-height: 1.15;
  }

  .rnc-task-editor-panel .rnc-task-dialog-heading-actions > [data-cancel] {
    width: var(--task-editor-control-height);
    min-width: var(--task-editor-control-height);
    padding: 0;
    font-size: 18px;
  }

  .rnc-task-editor-panel > label,
  .rnc-task-editor-panel label {
    gap: 3px;
    margin-bottom: 7px;
    font-size: 12px;
    line-height: 1.2;
  }

  .rnc-task-editor-panel textarea {
    box-sizing: border-box;
    min-height: 64px;
    height: 64px;
    padding: 7px 8px;
    border-radius: var(--task-editor-control-radius);
    font-size: var(--task-editor-control-font-size);
    line-height: 1.3;
  }

  .rnc-task-editor-panel .rnc-task-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 8px;
  }

  .rnc-task-editor-panel .rnc-task-form-grid > label > input,
  .rnc-task-editor-panel .rnc-task-form-grid > label > select {
    min-height: var(--task-editor-control-height) !important;
  }

  .rnc-task-editor-panel .rnc-task-check-label {
    gap: 6px !important;
    min-height: var(--task-editor-control-height);
  }

  .rnc-task-editor-panel .rnc-task-check-label input,
  .rnc-task-editor-panel .rnc-task-dependencies input[type="checkbox"],
  .rnc-task-editor-panel .rnc-task-linked-note-option input,
  .rnc-task-editor-panel .rnc-task-selected-check {
    width: 18px !important;
    min-width: 18px !important;
    height: 18px !important;
    min-height: 18px !important;
    max-height: 18px !important;
  }

  .rnc-task-editor-panel .rnc-task-dependencies,
  .rnc-task-editor-panel .rnc-task-linked-notes {
    margin: 3px 0 8px;
    padding: 7px;
    border-radius: 9px;
  }

  .rnc-task-editor-panel .rnc-task-dependencies legend,
  .rnc-task-editor-panel .rnc-task-linked-notes legend {
    padding: 0 4px;
    font-size: 12px;
  }

  .rnc-task-editor-panel .rnc-task-choice-picker > summary {
    box-sizing: border-box;
    min-height: var(--task-editor-control-height);
    padding: 7px 8px;
    border-radius: var(--task-editor-control-radius);
    font-size: var(--task-editor-control-font-size);
    line-height: 1.15;
  }

  .rnc-task-editor-panel .rnc-task-choice-picker[open] > summary,
  .rnc-task-editor-panel .rnc-task-choice-picker > p,
  .rnc-task-editor-panel .rnc-task-choice-search,
  .rnc-task-editor-panel .rnc-task-selected-choices {
    margin-bottom: 6px !important;
  }

  .rnc-task-editor-panel .rnc-task-choice-picker > p,
  .rnc-task-editor-panel [data-reminder-delivery-status] {
    font-size: 11px;
  }

  .rnc-task-editor-panel .rnc-task-choice-search {
    min-height: var(--task-editor-control-height) !important;
    height: var(--task-editor-control-height) !important;
    padding: 0 8px !important;
    border-radius: var(--task-editor-control-radius) !important;
    font-size: var(--task-editor-control-font-size) !important;
  }

  .rnc-task-editor-panel .rnc-task-selected-choice {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 6px;
    min-height: 30px;
    padding: 5px 7px;
    border-radius: var(--task-editor-control-radius);
    font-size: 11px;
  }

  .rnc-task-editor-panel .rnc-task-selected-linked-note {
    grid-template-columns: 18px minmax(0, 1fr) auto;
  }

  .rnc-task-editor-panel .rnc-task-dialog-status {
    min-height: 1.2em;
    margin: 4px 0;
    font-size: 11px;
  }

  .rnc-task-editor-panel .rnc-task-dialog-actions {
    position: sticky;
    z-index: 2;
    bottom: -12px;
    gap: 5px;
    margin: 7px -12px -12px;
    padding: 7px 12px 8px;
    border-top: 1px solid #ded4c5;
    background: #fffdf9;
  }
}

@media (max-width: 700px) {
  .rnc-task-editor-panel {
    --task-editor-control-height: 36px;
    --task-editor-control-font-size: 13px;
    --task-editor-control-radius: 8px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    font-size: var(--task-editor-control-font-size);
    overflow-x: hidden;
  }

  .rnc-task-editor-panel button,
  .rnc-task-editor-panel input,
  .rnc-task-editor-panel select {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    min-height: var(--task-editor-control-height) !important;
    height: var(--task-editor-control-height) !important;
    padding: 0 9px;
    border-radius: var(--task-editor-control-radius);
    font-size: var(--task-editor-control-font-size);
  }

  .rnc-task-editor-panel > label,
  .rnc-task-editor-panel label {
    gap: 4px;
    margin-bottom: 9px;
    font-size: 13px;
  }

  .rnc-task-editor-panel textarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-height: 72px;
    height: 72px;
    padding: 8px 9px;
    border-radius: var(--task-editor-control-radius);
    font-size: var(--task-editor-control-font-size);
  }

  .rnc-task-editor-panel .rnc-task-form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .rnc-task-editor-panel .rnc-task-form-grid > label > input,
  .rnc-task-editor-panel .rnc-task-form-grid > label > select {
    min-height: var(--task-editor-control-height) !important;
  }
}

/* A compact, always-visible safe exit beside the other primary actions. */
.safe-exit-button {
  width: 54px;
  min-width: 54px;
  height: 36px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.safe-exit-button:disabled {
  cursor: wait;
  opacity: .68;
}

@media (min-width: 701px) and (max-width: 900px) {
  .top-primary-actions {
    gap: 6px;
  }

  .top-primary-actions .quick-save-sync-area,
  .top-primary-actions .open-notebook-top-button {
    width: 92px;
    min-width: 92px;
  }

  .safe-exit-button {
    width: 50px;
    min-width: 50px;
  }
}

@media (max-width: 700px) {
  .top-primary-actions {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1fr)
      42px
      54px;
  }

  .safe-exit-button {
    width: 54px;
    min-width: 54px;
    height: 38px;
    min-height: 38px;
  }
}

/* Reminder completion is a compact note field, not a second action row. */
.note-reminder-controls {
  grid-template-columns:
    minmax(130px, 1fr)
    minmax(110px, .8fr)
    auto
    auto;
}

.note-reminder-completed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: var(--note-meta-control-height, 32px);
  margin: 0;
  padding: 0 3px;
  font-size: var(--note-meta-control-font-size, 12px);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.note-reminder-completed input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  max-height: 16px;
  margin: 0;
  padding: 0;
}

.note-reminder-completed input:disabled + span {
  opacity: .48;
}

.note-reminder.completed {
  text-decoration: none;
  opacity: .66;
}

@media (max-width: 700px) {
  .editor-secondary-options .note-reminder-controls,
  .note-reminder-controls {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1fr) !important;
  }

  .note-reminder-completed {
    grid-column: 1;
  }

  .editor-secondary-options .compact-reminder-clear,
  .compact-reminder-clear {
    grid-column: 2;
  }
}

/* =========================================================
   RNC tablet editor keyboard viewport
   Android tablets retain the desktop-width editor while their
   keyboard shortens visualViewport. Keep every editor control
   inside that visible area without changing normal desktop use.
   ========================================================= */

@media (min-width: 701px) {
  body.rnc-editor-keyboard-open .editor-backdrop {
    top: var(--rnc-mobile-vv-top, 0px);
    right: 0;
    bottom: auto;
    left: 0;
    height: var(--rnc-mobile-vv-height, 100dvh);
  }

  body.rnc-editor-keyboard-open .editor-modal {
    position: fixed !important;
    top: calc(var(--rnc-mobile-vv-top, 0px) + 6px) !important;
    bottom: auto !important;
    left: 50% !important;
    display: flex !important;
    flex-direction: column !important;
    width: min(820px, calc(100vw - 20px)) !important;
    height: calc(var(--rnc-mobile-vv-height, 100dvh) - 12px) !important;
    max-height: calc(var(--rnc-mobile-vv-height, 100dvh) - 12px) !important;
    overflow: hidden !important;
    transform: translateX(-50%) !important;
  }

  body.rnc-editor-keyboard-open
    .editor-modal > .document-editor {
    flex: 1 1 40px !important;
    min-height: 40px !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.rnc-editor-keyboard-open
    .editor-modal > .note-title-row,
  body.rnc-editor-keyboard-open
    .editor-modal > .format-toolbar,
  body.rnc-editor-keyboard-open
    .editor-modal > .editor-secondary-options {
    flex: 0 0 auto !important;
  }
}
