/* Theme tokens affect the workspace header, keeping the document's reading theme separate. */
.funify-notes-page .site-header {
  background: var(--notes-header-background, linear-gradient(110deg, #aac4f5, #8eade9, #7899dc));
  color: var(--notes-header-foreground, #24344e);
}

.funify-notes-page .site-header .notes-workspace-header-button,
.funify-notes-page .site-header .menu {
  color: var(--notes-header-foreground, #24344e);
}

.funify-notes-page .notes-workspace-header-search {
  border-color: var(--notes-header-line, rgb(36 52 78 / 18%));
  background: var(--notes-header-search, rgb(255 255 255 / 50%));
  color: var(--notes-header-foreground, #24344e);
}

.funify-notes-page .notes-workspace-header-search input {
  color: var(--notes-header-foreground, #24344e);
}

.funify-notes-page .notes-workspace-header-search input::placeholder,
.funify-notes-page .notes-workspace-header-search kbd {
  color: var(--notes-header-muted, #40536c);
}

.funify-notes-page .notes-workspace-header-search kbd {
  border-color: var(--notes-header-line, rgb(36 52 78 / 18%));
}

.funify-notes-page .notes-workspace-header-search:focus-within {
  border-color: color-mix(in srgb, var(--notes-header-foreground, #24344e) 35%, transparent);
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--notes-header-foreground, #24344e) 12%, transparent);
}

.funify-notes-page .site-header .notes-workspace-header-search input:focus,
.funify-notes-page .site-header .notes-workspace-header-search input:focus-visible {
  outline: none;
  box-shadow: none;
}

.funify-notes-page .notes-workspace-header-search:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.funify-notes-page .notes-workspace-header-search input:disabled {
  cursor: not-allowed;
}

.funify-notes-page .site-header .notes-workspace-header-button:hover,
.funify-notes-page .site-header .menu:hover {
  background-color: var(--notes-header-hover, rgb(255 255 255 / 45%));
}

.funify-notes-page .site-header .notes-workspace-home-badge {
  fill: var(--notes-header-badge, #8eade9);
}

.funify-notes-page .site-header .menu {
  background-image: none;
}

.funify-notes-page .site-header .menu::before,
.funify-notes-page .site-header .menu[aria-expanded='true']::before {
  display: none;
}

.funify-notes-page .site-header .site-menu .notes-header-theme-menu-button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text, #17223b);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.funify-notes-page .site-header .site-menu .notes-header-theme-menu-button:hover {
  background: var(--notes-workspace-soft, #e8eeff);
}

.funify-notes-page .site-header .site-menu {
  min-width: 160px;
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.notes-header-theme-dialog {
  width: min(660px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 25px;
  border: 1px solid var(--color-border, #dfe5fa);
  border-radius: 22px;
  background: var(--color-surface, #fff);
  color: var(--color-text, #0c123e);
  box-shadow: 0 20px 65px rgb(20 35 68 / 24%);
}

.notes-header-theme-dialog::backdrop {
  background: rgb(13 25 52 / 45%);
}

.notes-header-theme-dialog h2 {
  margin: 0 0 8px;
  font-size: 23px;
}

.notes-header-theme-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.notes-header-theme-heading h2 {
  margin: 0;
}

.notes-header-theme-heading .notes-btn {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
}

.notes-header-theme-help {
  margin: 0 0 20px;
  color: var(--color-muted, #485c91);
  font-size: 13px;
}

.notes-header-theme-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.notes-header-theme-option {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border, #dfe5fa);
  border-radius: 12px;
  background: var(--color-surface, #fff);
  cursor: pointer;
}

.notes-header-theme-option:has(input:checked) {
  border-color: var(--notes-selection-accent, #9c81b8);
  outline: 2px solid var(--notes-selection-accent, #9c81b8);
  outline-offset: 1px;
}

.notes-header-theme-option:focus-within {
  outline: 2px solid var(--notes-selection-accent, #9c81b8);
  outline-offset: 3px;
}

.notes-header-theme-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 64px;
  padding: 10px;
}

.notes-header-theme-preview img {
  width: 26px;
  height: 26px;
}

.notes-header-theme-search {
  flex: 1;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 6px;
  opacity: 0.3;
}

.notes-header-theme-avatar {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.notes-header-theme-caption {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  font-size: 12px;
}

.notes-header-theme-caption input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--notes-selection-accent, #9c81b8);
}

.notes-header-theme-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.notes-header-theme-actions .notes-btn {
  min-width: 80px;
  min-height: 36px;
}

@media screen and (max-width: 599px) {
  .notes-header-theme-dialog {
    padding: 20px;
  }

  .notes-header-theme-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .notes-header-theme-preview {
    gap: 4px;
    height: 56px;
    padding: 7px;
  }
}

@media print {
  .notes-header-theme-dialog {
    display: none !important;
  }
}

.notes-theme-section-title {
  margin: 0 0 12px;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
}

.notes-selection-colors {
  min-width: 0;
  margin: 24px 0 0;
  padding: 0;
  border: 0;
}

.notes-selection-help {
  margin: 0 0 12px;
  color: var(--color-muted);
  font-size: 12px;
}

.notes-selection-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.notes-selection-color-option,
.notes-selection-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 12px;
}

.notes-selection-color-option {
  cursor: pointer;
}

.notes-selection-color-option:has(input:checked),
.notes-selection-custom:has(input:checked) {
  border-color: var(--notes-selection-accent);
  background: var(--notes-selection-background);
  color: var(--notes-selection-text);
}

.notes-selection-color-option:focus-within,
.notes-selection-custom:focus-within {
  outline: 2px solid var(--notes-selection-accent);
  outline-offset: 2px;
}

.notes-selection-swatch {
  flex: 0 0 18px;
  height: 18px;
  border: 1px solid rgb(0 0 0 / 12%);
  border-radius: 50%;
}

.notes-selection-custom {
  margin-top: 8px;
}

.notes-selection-custom-label {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.notes-selection-custom input[type='color'] {
  width: 40px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: var(--color-surface);
  cursor: pointer;
}

#notesSelectionCustomHex {
  width: 92px;
  min-width: 0;
  height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-family: monospace;
}

#notesSelectionCustomHex[aria-invalid='true'] {
  border-color: #c83a4f;
}

.notes-selection-error {
  margin: 8px 0 0;
  color: var(--color-text);
  font-size: 12px;
}

.funify-notes-page
  :is(.notes-header-theme-dialog, .notes-hero-dialog)
  input:is([type='radio'], [type='checkbox']) {
  accent-color: var(--notes-selection-accent);
}

.funify-notes-page .notes-workspace-nav-button[aria-current='page'],
.funify-notes-page .notes-workspace-tree-row[data-active='true'],
.funify-notes-page .notes-format-panel .notes-text-pill[aria-pressed='true'],
.funify-notes-page .notes-list-option[aria-selected='true'],
.funify-notes-page .notes-mobile-main-tool:is([aria-pressed='true'], [aria-expanded='true']),
.funify-notes-page .notes-mobile-editor-tools .notes-mobile-tile[aria-pressed='true'],
.funify-notes-page .notes-hero-background-option:has(input:checked),
.funify-notes-page .notes-hero-font-option:has(input:checked) {
  border-color: var(--notes-selection-accent);
  background: var(--notes-selection-background);
  color: var(--notes-selection-text);
}

.funify-notes-page .notes-workspace-folder-link[aria-current='page'] {
  color: var(--notes-selection-text);
}

.funify-notes-page .notes-format-panel .notes-color-swatch[aria-pressed='true'],
.funify-notes-page .notes-custom-color.is-selected {
  outline-color: var(--notes-selection-accent);
}

@media screen and (max-width: 599px) {
  .notes-selection-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.notes-clear-browser-dialog {
  width: min(480px, calc(100vw - 32px));
  border-radius: 14px;
}

.notes-clear-browser-description,
.notes-clear-browser-status {
  font-size: 13px;
  line-height: 1.7;
}

.notes-clear-browser-description {
  margin: 14px 0;
  color: var(--color-muted);
}

.notes-clear-browser-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.funify-notes-page .notes-clear-browser-confirm {
  border-color: #b42338;
  background: #b42338;
  color: #fff;
}

.funify-notes-page .notes-clear-browser-confirm:hover:not(:disabled) {
  background: #921c2e;
}
