.domain-actions .icon-btn {
  /* unify icon sizes with note actions */
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

/* Rotate shimmer per instance to avoid identical look side-by-side */
.note-actions .icon-btn:nth-child(1)::after {
  transform: rotate(0deg);
}

.note-actions .icon-btn:nth-child(2)::after {
  transform: rotate(40deg);
}

.note-actions .icon-btn:nth-child(3)::after {
  transform: rotate(95deg);
}

.note-actions .icon-btn:nth-child(4)::after {
  transform: rotate(140deg);
}

.note-actions .icon-btn:nth-child(5)::after {
  transform: rotate(210deg);
}

.domain-actions .icon-btn:nth-child(1)::after {
  transform: rotate(15deg);
}

.domain-actions .icon-btn:nth-child(2)::after {
  transform: rotate(70deg);
}

.domain-actions .icon-btn:nth-child(3)::after {
  transform: rotate(130deg);
}

.domain-actions .icon-btn:nth-child(4)::after {
  transform: rotate(185deg);
}

.domain-actions .icon-btn:nth-child(5)::after {
  transform: rotate(240deg);
}

.header .icon-btn:nth-child(1)::after {
  transform: rotate(25deg);
}

.header .icon-btn:nth-child(2)::after {
  transform: rotate(85deg);
}

.header .icon-btn:nth-child(3)::after {
  transform: rotate(145deg);
}

.header .icon-btn:nth-child(4)::after {
  transform: rotate(200deg);
}

.header .icon-btn:nth-child(5)::after {
  transform: rotate(260deg);
}

/* Stronger per-instance variation: offset gradient centers, angles, opacity, and thickness */
.note-actions .icon-btn:nth-child(1)::after {
  background:
    conic-gradient(from 110deg at 58% 42%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 65deg,
      rgba(0, 0, 0, 0.20) 145deg,
      rgba(255, 255, 255, 0.12) 225deg,
      rgba(255, 255, 255, 0.55) 360deg);
  opacity: 0.88;
  padding: var(--ring-padding, 1px);
}

.note-actions .icon-btn:nth-child(2)::after {
  background:
    conic-gradient(from 250deg at 42% 60%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 60deg,
      rgba(0, 0, 0, 0.20) 140deg,
      rgba(255, 255, 255, 0.12) 220deg,
      rgba(255, 255, 255, 0.55) 360deg);
  opacity: 0.75;
  padding: 0.5px;
}

.note-actions .icon-btn:nth-child(3)::after {
  background:
    conic-gradient(from 190deg at 55% 45%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 70deg,
      rgba(0, 0, 0, 0.18) 150deg,
      rgba(255, 255, 255, 0.12) 230deg,
      rgba(255, 255, 255, 0.55) 360deg);
  opacity: 0.82;
  padding: 0.75px;
}

.domain-actions .icon-btn:nth-child(1) {
  --btn-shimmer: conic-gradient(from 140deg at 60% 40%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 65deg,
      rgba(0, 0, 0, 0.20) 145deg,
      rgba(255, 255, 255, 0.12) 225deg,
      rgba(255, 255, 255, 0.55) 360deg);
  --ring-opacity: 0.86;
  --ring-padding: 1px;
}

.domain-actions .icon-btn:nth-child(2) {
  --btn-shimmer: conic-gradient(from 300deg at 40% 62%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 60deg,
      rgba(0, 0, 0, 0.20) 140deg,
      rgba(255, 255, 255, 0.12) 220deg,
      rgba(255, 255, 255, 0.55) 360deg);
  --ring-opacity: 0.74;
  --ring-padding: 0.5px;
}

.header .icon-btn:nth-child(1) {
  --btn-shimmer: conic-gradient(from 90deg at 56% 44%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 70deg,
      rgba(0, 0, 0, 0.18) 150deg,
      rgba(255, 255, 255, 0.12) 230deg,
      rgba(255, 255, 255, 0.55) 360deg);
  --ring-opacity: 0.85;
  --ring-padding: 0.85px;
}

.header .icon-btn:nth-child(2) {
  --btn-shimmer: conic-gradient(from 230deg at 44% 58%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 60deg,
      rgba(0, 0, 0, 0.20) 140deg,
      rgba(255, 255, 255, 0.12) 220deg,
      rgba(255, 255, 255, 0.55) 360deg);
  --ring-opacity: 0.76;
  --ring-padding: 0.6px;
}

/* Default shimmer, can be overridden via --btn-shimmer per instance */
.note-actions .icon-btn::after {
  background: var(--btn-shimmer,
      conic-gradient(from 160deg at 50% 50%,
        rgba(255, 255, 255, 0.55) 0deg,
        rgba(255, 255, 255, 0.10) 70deg,
        rgba(0, 0, 0, 0.18) 140deg,
        rgba(255, 255, 255, 0.12) 220deg,
        rgba(255, 255, 255, 0.55) 360deg));
}

.domain-actions .icon-btn::after {
  background:
    conic-gradient(from 220deg at 50% 50%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 70deg,
      rgba(0, 0, 0, 0.18) 140deg,
      rgba(255, 255, 255, 0.12) 220deg,
      rgba(255, 255, 255, 0.55) 360deg);
}

.site-icon .icon-btn::after {
  background:
    conic-gradient(from 120deg at 50% 50%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 70deg,
      rgba(0, 0, 0, 0.18) 140deg,
      rgba(255, 255, 255, 0.12) 220deg,
      rgba(255, 255, 255, 0.55) 360deg);
}

.header .icon-btn::after {
  background:
    conic-gradient(from 280deg at 50% 50%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 70deg,
      rgba(0, 0, 0, 0.18) 140deg,
      rgba(255, 255, 255, 0.12) 220deg,
      rgba(255, 255, 255, 0.55) 360deg);
}

.domain-actions .icon-btn svg {
  width: 14px;
  height: 14px;
  opacity: var(--ring-opacity, 0.9);
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  will-change: transform;
}

.domain-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.domain-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  /* match note actions spacing */
}

/* Domain header actions: visible by default; when group is open, hide unless hovered/focused */
details.domain-group > .domain-actions {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

details.domain-group[open] > .domain-actions {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: none !important;
  /* avoid delay flash when opening */
}

details.domain-group[open]:hover > .domain-actions,
details.domain-group[open]:focus-within > .domain-actions {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Base Component Styles */

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: transparent;
  line-height: 1.4;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ensure Chrome sizes the popup correctly */
html,
body {
  width: 400px;
  height: 600px;
  /* Chrome popup max ~600px; avoid forced inner scroll */
  overflow: hidden;
  margin: 0;
  padding: 0;
  background: var(--bg-secondary);
  /* fill edge-to-edge; no white corners */
}

.app-container {
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
  /* match header/main background */
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  border: none;
  border-radius: 0;
  /* unrounded corners per request */
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  contain: layout paint;
}

/* Subtle gradient overlay to reduce flatness */
.app-container::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 255, 255, 0.02), transparent 50%),
    radial-gradient(100% 70% at 0% 100%, rgba(0, 0, 0, 0.06), transparent 55%);
  mix-blend-mode: normal;
  opacity: 1;
}

/* Header Styles */
.header {
  background: var(--bg-secondary);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  border-bottom: 1px solid var(--border-color);
  padding: 8px 0;
  /* full-bleed background */
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding: 0 12px;
  /* inner horizontal padding */
}

.site-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.site-icon {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  overflow: hidden;
  display: block;
}

.site-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

.site-icon .site-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-tertiary);
}

.site-icon .site-fallback svg {
  width: 18px;
  height: 18px;
}

.site-icon .icon-btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  /* match card background; avoid default white */
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 160ms ease, color 120ms ease, border-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}

.site-details {
  flex: 1;
  min-width: 0;
  /* Keep only a small buffer from shortcut hints */
  padding-right: 12px;
}

.site-domain {
  font-weight: 600;
  font-size: 15px;
  /* restore fuller size */
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-url {
  font-size: 12.5px;
  /* restore legibility */
  line-height: 1.25;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  /* do not shrink; keep fixed width */
}

/* Unified icon button base for header, notes, and domain actions */
.header .icon-btn,
.note-actions .icon-btn,
.domain-actions .icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  /* Glass visual surface */
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inset), var(--glass-shadow);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
}

/* Normalize icon sizes and centering */
.header .icon-btn svg,
.note-actions .icon-btn svg,
.domain-actions .icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  /* avoid inline baseline misalignment */
  opacity: 0.9;
}

/* Consistent hover for glass buttons (settings, note, domain icons) */
.header .icon-btn:hover,
.note-actions .icon-btn:hover,
.domain-actions .icon-btn:hover {
  background: var(--glass-bg-hover);
}

/* Settings icon: ensure white glyph on glass */
#settingsBtn svg {
  color: #fff;
  stroke: #fff;
  opacity: 1;
}

/* Utility Styles */
.glass {
  /* Visual-only utility. Do not include layout props here. */
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inset), var(--glass-shadow);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
}

.icon-btn:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 0 var(--shadow-light);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  background: transparent;
  /* avoid any white artifact */
  opacity: 0.9;
}

.icon-btn.sm svg {
  width: 14px;
  height: 14px;
}

/* Icon button modifiers */
.icon-btn.sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.icon-btn.glass {
  background: var(--bg-primary);
  opacity: 0.95;
}

/* Search Container */
.search-container {
  padding: 8px 0;
  /* full-bleed background */
  /* Differentiate search band from rest of UI */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 12px 12px;
  /* add inner horizontal padding */
  /* More distinct than title/filter surfaces */
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 var(--shadow-light);
}

.search-wrapper:hover {
  background: color-mix(in oklab, var(--bg-secondary) 98%, white 2%);
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-tertiary);
  pointer-events: none;
  z-index: 1;
}

.search-input {
  width: 100%;
  height: 40px;
  border: 1px solid transparent;
  /* inner field blends into wrapper */
  border-radius: 16px;
  padding: 0 36px 0 36px;
  /* room for icons */
  background: transparent;
  /* inherit wrapper tone */
  color: var(--text-primary);
  outline: none;
  transition: box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
  box-shadow: inset 0 1px 0 var(--shadow-light);
}

.search-input:focus {
  /* Colorless (neutral) focus treatment */
  border-color: var(--border-color);
  box-shadow: inset 0 1px 0 var(--shadow-light), 0 0 0 2px rgba(255, 255, 255, 0.06);
}

.search-input::placeholder {
  color: var(--placeholder);
}

.search-clear {
  position: absolute;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 3px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Filter Container */
.filter-container {
  margin: 4px 12px 0;
  /* match search-wrapper side margins */
  display: flex;
  justify-content: center;
  padding: 0;
  /* use margins instead of padding to match length */
  height: 34px;
  /* match search bar height in compact */
}

.filter-wrapper {
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  /* ensure full width so pills fill */
  border-radius: 14px;
  /* rounded ends for the band */
  padding: 0;
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
}

.filter-wrapper:hover {
  background: color-mix(in oklab, var(--bg-primary) 88%, white 12%);
}

.filter-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  /* tighter icon/text spacing */
  padding: 7px 10px;
  /* comfortable vertical, symmetric horizontal */
  border-radius: 0;
  /* remove rounding so ends touch */
  /* Glassmorphic pill surface */
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  /* default outline via utility */
  color: var(--text-secondary);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  font-size: 13px;
  /* original size */
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  /* include transform */
  white-space: nowrap;
  flex: 1 1 0;
  /* fill evenly across wrapper */
  min-width: 0;
  /* prevent growth by text */
  box-shadow: var(--glass-inset), var(--glass-shadow);
  background-clip: padding-box;
  /* ensure borders don't create seams */
  position: relative;
  /* allow z-index stacking to hide seams */
}

/* Shimmering outline for filter buttons (subtle by default, stronger on hover) */
.filter-option::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  padding: 1px;
  background:
    conic-gradient(from 220deg at 50% 50%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 70deg,
      rgba(0, 0, 0, 0.18) 140deg,
      rgba(255, 255, 255, 0.12) 220deg,
      rgba(255, 255, 255, 0.55) 360deg);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.75;
}

/* Round only the ends of the pill group */
.filter-option:first-child {
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}

.filter-option:last-child {
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
}

/* Revert overlap; keep normal spacing so wrapper band is intact */
.filter-option+.filter-option {
  margin-left: 0;
}

.filter-option:hover {
  color: var(--text-primary);
  background: var(--glass-bg-hover);
  border-color: transparent;
  /* keep outline hidden on hover */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 3px 10px rgba(0, 0, 0, 0.09);
}

/* Make shimmer ring a bit more noticeable on hover */
.filter-option:hover::after {
  opacity: 0.9;
}

.filter-option.active {
  /* Accent-tinted glass */
  color: white;
  background: var(--accent-glass-bg);
  border-color: var(--accent-glass-border);
  /* only active shows outline */
  box-shadow: var(--accent-glass-inset), var(--accent-glass-shadow);
}

.filter-option svg {
  width: 14px;
  /* match search icon sizing */
  height: 14px;
}

.filter-option span,
.filter-option svg {
  opacity: 0.80;
}

/* soften inactive intensity */
.filter-option:hover span,
.filter-option:hover svg {
  opacity: 0.92;
}

.filter-option.active span,
.filter-option.active svg {
  opacity: 1;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  /* remove side padding to avoid visual gaps */
  background: var(--canvas-bg);
  /* Ensure main content has proper height constraints */
  min-height: 0;
  max-height: 100%;
}

/* Notes Container */
.notes-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* prevent outer scroll; inner list will scroll */
  background: var(--canvas-bg);
  padding: 0;
  /* full-bleed for headers */
  min-height: 0;
  /* allow flex child to shrink so ad bar is visible */
  max-height: 100%;
  /* prevent container from expanding beyond viewport */
  /* Constrain visual content width for a more natural reading measure */
  --content-max: 660px;
  position: relative;
  /* For absolute positioning of counter */
}

/* Notes header background band */
.notes-header-band {
  flex: 1 1 auto;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  /* ends at the bottom of the notes header */
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.03));
  /* darker, no white tint */
  z-index: 0;
  pointer-events: none;
}

.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1px 16px 2px;
  /* align with list padding; keep title left and button right */
  padding: 8px 16px;
  /* align with .notes-list horizontal padding */
  background: transparent;
  /* hide container */
  border: 1px solid transparent;
  /* remove outline */
  border-radius: 16px;
  /* keep layout rounding without visible border */
  box-shadow: none;
  /* remove inner line */
  position: relative;
  z-index: 1;
  /* sit above the band */
}

.notes-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.domain-selection {
  margin: 16px 0;
}

.domain-selection h5 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.domain-dropdown-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.domain-select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.domain-select:focus {
  border-color: var(--accent-color);
}

.domain-info {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

/* All Notes only: hide per-note actions inside domain dropdown list */
html[data-view="all_notes"] details.domain-group>.domain-notes-list .note-item .note-sidebar,
html[data-view="all_notes"] details.domain-group>.domain-notes-list .note-item .note-actions {
  display: flex !important;
  /* keep layout stable; only fade */
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 120ms ease-out !important;
  transition-delay: 0s !important;
  will-change: opacity;
}

html[data-view="all_notes"] details.domain-group>.domain-notes-list .note-item:hover .note-sidebar,
html[data-view="all_notes"] details.domain-group>.domain-notes-list .note-item:hover .note-actions,
html[data-view="all_notes"] details.domain-group>.domain-notes-list .note-item:focus-within .note-sidebar,
html[data-view="all_notes"] details.domain-group>.domain-notes-list .note-item:focus-within .note-actions {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Broader match: any note items inside a domain group (safety net) */
html[data-view="all_notes"] details.domain-group .note-item .note-sidebar,
html[data-view="all_notes"] details.domain-group .note-item .note-actions {
  display: flex !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 220ms ease-out !important;
  transition-delay: 0s !important;
  will-change: opacity;
}

html[data-view="all_notes"] details.domain-group .note-item:hover .note-sidebar,
html[data-view="all_notes"] details.domain-group .note-item:hover .note-actions,
html[data-view="all_notes"] details.domain-group .note-item:focus-within .note-sidebar,
html[data-view="all_notes"] details.domain-group .note-item:focus-within .note-actions {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* All Notes view: when group is open, hide header actions unless hovered/focused (explicit) */
html[data-view="all_notes"] details.domain-group[open] > .domain-actions {
  display: flex !important;
  /* keep layout; only fade */
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 220ms ease-out !important;
  transition-delay: 0s !important;
  will-change: opacity;
}

html[data-view="all_notes"] details.domain-group[open]:hover > .domain-actions,
html[data-view="all_notes"] details.domain-group[open]:focus-within > .domain-actions {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Fallback: enforce same hover-only behavior for notes inside any domain-group,
   regardless of data-view attribute presence. Safe because only All Notes uses
   details.domain-group rendering. */
details.domain-group .domain-notes-list .note-item:not(:hover):not(:focus-within) .note-sidebar,
details.domain-group .domain-notes-list .note-item:not(:hover):not(:focus-within) .note-actions {
  display: flex !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 220ms ease-out !important;
  transition-delay: 0s !important;
  will-change: opacity;
}

details.domain-group .domain-notes-list .note-item:hover .note-sidebar,
details.domain-group .domain-notes-list .note-item:hover .note-actions,
details.domain-group .domain-notes-list .note-item:focus-within .note-sidebar,
details.domain-group .domain-notes-list .note-item:focus-within .note-actions {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* All Notes only: hide note UI buttons until hover/focus (top-level notes only) */
html[data-view="all_notes"] .notes-list>.note-item .note-sidebar,
html[data-view="all_notes"] .notes-list>.note-item .note-actions {
  display: flex !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease-out !important;
  transition-delay: 0s !important;
  will-change: opacity;
}

html[data-view="all_notes"] .notes-list>.note-item:hover .note-sidebar,
html[data-view="all_notes"] .notes-list>.note-item:hover .note-actions,
html[data-view="all_notes"] .notes-list>.note-item:focus-within .note-sidebar,
html[data-view="all_notes"] .notes-list>.note-item:focus-within .note-actions {
  opacity: 1;
  pointer-events: auto;
}

/* Site/Page views: always show note actions (override hover-hide) */
html[data-view="site"] .notes-list .note-item .note-sidebar,
html[data-view="site"] .notes-list .note-item .note-actions,
html[data-view="site"] .domain-notes-list .note-sidebar,
html[data-view="site"] .domain-notes-list .note-actions,
html[data-view="page"] .notes-list .note-item .note-sidebar,
html[data-view="page"] .notes-list .note-item .note-actions,
html[data-view="page"] .domain-notes-list .note-sidebar,
html[data-view="page"] .domain-notes-list .note-actions,
/* Fallback: in Site/Page, force all note items' actions visible regardless of container */
html[data-view="site"] .note-item .note-sidebar,
html[data-view="site"] .note-item .note-actions,
html[data-view="page"] .note-item .note-sidebar,
html[data-view="page"] .note-item .note-actions {
  opacity: 1 !important;
  pointer-events: auto !important;
  transition: none !important;
}

/* Force note actions to be visible in Site/Page views regardless of container */
html[data-view="site"] .note-item .note-actions,
html[data-view="page"] .note-item .note-actions {
  opacity: 1 !important;
  pointer-events: auto !important;
  transition: none !important;
  display: flex !important;
}

.notes-header:hover {
  background: transparent;
  /* no visual change on hover */
}

.notes-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.add-note-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 14px;
  /* Accent-tinted glass like filter active */
  background: linear-gradient(180deg,
      color-mix(in oklab, var(--accent-primary) 26%, rgba(255, 255, 255, 0.18)),
      color-mix(in oklab, var(--accent-primary) 18%, rgba(255, 255, 255, 0.06)));
  border: 1px solid color-mix(in oklab, var(--accent-primary) 45%, rgba(255, 255, 255, 0.28));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 3px 10px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  position: relative;
  isolation: isolate;
}

.add-note-btn:hover {
  background: linear-gradient(180deg,
      color-mix(in oklab, var(--accent-primary) 36%, rgba(255, 255, 255, 0.22)),
      color-mix(in oklab, var(--accent-primary) 24%, rgba(255, 255, 255, 0.10)));
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 4px 12px rgba(0, 0, 0, 0.14);
}

.add-note-btn:active {
  transform: translateY(0);
}

.add-note-btn svg {
  width: 16px;
  height: 16px;
}

.add-note-btn span {
  color: #fff;
  opacity: 0.86;
  /* softer white */
}

.add-note-btn svg {
  color: #fff;
  opacity: 0.86;
  /* softer white */
}

/* Global Layout */
:root {
  /* Stable canvas background to avoid site-by-site variance */
  --canvas-bg: var(--bg-secondary);
  /* match header exactly */
}

html,
body {
  background: var(--canvas-bg);
}

/* Toast Notification - Updated to match sync notification theme */
.toast {
  position: absolute;
  /* within .app-container (relative) */
  left: 50%;
  top: 12px;
  /* show at top, above editor */
  bottom: auto;
  transform: translate(-50%, -8px);
  z-index: 10001;
  /* above .note-editor (9999) */
  max-width: calc(100% - 24px);
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  box-shadow: var(--glass-inset), var(--glass-shadow);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  opacity: 0;
  pointer-events: none;
  /* let clicks pass through */
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Toast variants for different message types */
.toast.success {
  background: linear-gradient(180deg, rgba(0, 122, 255, 0.15), rgba(0, 122, 255, 0.08));
  border-color: rgba(0, 122, 255, 0.25);
  color: var(--text-primary);
}

.toast.error {
  background: linear-gradient(180deg, rgba(255, 59, 48, 0.15), rgba(255, 59, 48, 0.08));
  border-color: rgba(255, 59, 48, 0.25);
  color: var(--text-primary);
}

.toast.info {
  background: linear-gradient(180deg, rgba(0, 122, 255, 0.15), rgba(0, 122, 255, 0.08));
  border-color: rgba(0, 122, 255, 0.25);
  color: var(--text-primary);
}

/* Notification icon styling */
.notification-icon {
  font-size: 16px;
  font-weight: bold;
  opacity: 0.9;
}

.notification-message {
  flex: 1;
  line-height: 1.4;
}

/* Notification animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.notification {
  animation: slideInRight 0.3s ease-out;
}

/* Notes List */
.notes-list {
  flex: 1 1 auto;
  min-height: 0;
  /* critical for scroll inside flex column */
  max-height: 100%;
  /* prevent infinite expansion */
  overflow-y: auto;
  overflow-x: hidden;
  /* prevent horizontal scroll */
  padding: 6px 16px 10px;
  /* add breathing room */
  position: relative;
  z-index: 1;
  /* above the band */
  background: var(--bg-secondary);
  /* prevent band from showing through gaps */
  /* Ensure scrollbar doesn't cause layout shifts */
  scrollbar-gutter: stable;
  /* Let the list span full width; cards themselves are constrained */
}

/* Filter transition animations */
.notes-list.filter-transition {
  transition: opacity 0.2s ease, transform 0.2s ease;
}



/* Compact mode: shrink global spacing and sizes to avoid scroll/clipping */
html[data-compact="1"] body {
  font-size: 13px;
}

html[data-compact="1"] .header {
  padding: 4px 0;
}

html[data-compact="1"] .header-content {
  margin-bottom: 2px;
  padding: 0 10px;
}

/* Further condense header in compact mode */
html[data-compact="1"] .site-info {
  gap: 8px;
}

html[data-compact="1"] .site-icon {
  width: 28px;
  height: 28px;
}

html[data-compact="1"] .site-domain {
  font-size: 14px;
}

html[data-compact="1"] .site-url {
  font-size: 11.5px;
  line-height: 1.2;
}

html[data-compact="1"] #shortcutHints {
  font-size: 10.5px !important;
  gap: 1px !important;
}

html[data-compact="1"] .header .icon-btn {
  width: 32px;
  height: 32px;
}

html[data-compact="1"] .header .icon-btn svg {
  width: 14px;
  height: 14px;
}

html[data-compact="1"] .site-details {
  padding-right: 8px;
}

html[data-compact="1"] .notes-container {
  --content-max: 600px;
  /* slightly narrower in compact mode */
}

html[data-compact="1"] .search-container {
  padding: 6px 0;
}

html[data-compact="1"] .search-wrapper {
  margin: 0 10px 6px;
}

html[data-compact="1"] .search-input {
  height: 34px;
  padding: 0 34px 0 34px;
}

html[data-compact="1"] .filter-wrapper {
  padding: 2px;
  /* keep buttons connected in compact mode */
}

html[data-compact="1"] .filter-option {
  padding: 6px 6px;
  /* taller pill within same bar height */
  font-size: 12px;
  /* original compact size */
}

html[data-compact="1"] .notes-header {
  padding: 8px 10px;
}

html[data-compact="1"] .add-note-btn {
  padding: 6px 8px;
  font-size: 12px;
}

html[data-compact="1"] .notes-list {
  padding: 6px 10px 6px;
}

/* Onboarding panel: prevent internal scroll and ensure full fit */
#onboardingPanel .settings-content {
  overflow: hidden;
}

#onboardingPanel #onboardingFrame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  overflow: hidden;
}

.note-content {
  display: flex;
  align-items: center;
  height: 100%;
  position: relative;
}

.note-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding-right: 112px;
  /* reserve space for right sidebar (actions/tags area) */
}

.note-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-date-inline {
  font-size: 12px;
  color: var(--text-tertiary);
}

.note-tags-inline {
  display: flex;
  gap: 4px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.note-tag-inline {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 1px 4px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.2;
  opacity: 0.85;
  min-width: 16px;
  /* Ensure consistent minimum width */
  text-align: center;
  display: inline-block;
  box-shadow: inset 0 1px 0 var(--shadow-light);
}

/* Ensure consistent sizing for notes with and without tags */
.note-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding-right: 112px;
  /* reserve space for right sidebar (actions/tags area) */
  min-height: 32px;
  /* ensure consistent height */
}

/* Add placeholder for notes without tags to maintain consistent height */
.note-tags-inline:empty::before {
  content: '';
  display: block;
  height: 12px;
  /* Match tag height */
  visibility: hidden;
}

.note-sidebar {
  position: absolute;
  right: 6px;
  /* closer to right edge */
  top: 8px;
  bottom: 8px;
  /* anchor to bottom so tags can sit at bottom-right */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  width: 112px;
  /* matches padding-right reserved space */
}

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

/* Ensure domain and note action icons are visually identical */
.note-actions .icon-btn,
.domain-actions .icon-btn,
.note-actions .icon-btn.glass,
.domain-actions .icon-btn.glass {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  /* Glass base via utility */
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inset), var(--glass-shadow);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  position: relative;
  isolation: isolate;
  /* contain pseudo-element blending */
}

.note-actions .icon-btn svg,
.domain-actions .icon-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  color: var(--text-secondary);
  /* subdued until hover */
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
  /* quieter until hover */
}

.note-actions .icon-btn:hover,
.domain-actions .icon-btn:hover {
  background: var(--glass-bg-hover);
  border-color: color-mix(in oklab, var(--border-color) 60%, rgba(255, 255, 255, 0.32));
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 3px 10px rgba(0, 0, 0, 0.09);
}

.note-actions .icon-btn:active,
.domain-actions .icon-btn:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 0 var(--shadow-light);
}



.note-tag {
  background: var(--accent-color);
  color: #fff;
  padding: 1px 4px;
  border-radius: 8px;
  font-size: 8px;
  font-weight: 500;
  white-space: nowrap;
}

.icon-btn.confirm {
  background: rgba(220, 68, 68, 0.16);
  border: 1px solid rgba(220, 68, 68, 0.35);
}

.icon-btn.confirm svg {
  color: #ff6b6b;
  stroke: #ff6b6b;
}

/* Two-tap delete armed state (alias to confirm with stronger cue) */
.icon-btn.danger {
  background: rgba(220, 68, 68, 0.22);
  border: 1px solid rgba(220, 68, 68, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 10px rgba(220, 68, 68, 0.18);
}

.icon-btn.danger svg {
  color: #ff5a5a;
  stroke: #ff5a5a;
}

.icon-btn:hover {
  background: color-mix(in oklab, var(--accent-primary) 10%, transparent);
  box-shadow: inset 0 1px 0 var(--shadow-light), 0 2px 8px var(--shadow-dark);
}

/* Re-assert note/domain action hover styles with higher precedence */
.note-actions .icon-btn:hover,
.domain-actions .icon-btn:hover {
  background: var(--bg-secondary);
  /* reveal surface on hover */
  border-color: var(--border-color);
  /* show outline on hover */
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 var(--shadow-light), 0 2px 8px var(--shadow-dark);
}

.note-actions .icon-btn:hover svg,
.domain-actions .icon-btn:hover svg {
  color: var(--text-primary);
  stroke: var(--text-primary);
  opacity: 1;
}

/* Darken hover a bit more specifically for the All Notes tab */
#showAllNotesBtn:hover {
  filter: brightness(0.88);
}

html[data-compact="1"] .note-item {
  padding: 6px 8px;
  margin-bottom: 6px;
  height: 56px;
}

html[data-compact="1"] .note-title {
  font-size: 12px;
}

html[data-compact="1"] .note-preview {
  font-size: 10.5px;
}

html[data-compact="1"] .note-actions .icon-btn {
  width: 28px;
  height: 28px;
}

/* Match domain action sizes to note action sizes in compact mode */
html[data-compact="1"] .domain-actions .icon-btn {
  width: 28px;
  height: 28px;
}

html[data-compact="1"] .note-meta {
  font-size: 9px;
}

html[data-compact="1"] .domain-group-header {
  padding: 10px 12px;
}

html[data-compact="1"] .domain-notes-list {
  /* Match compact .notes-list padding (6px 10px 6px) */
  padding: 6px 10px 6px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-icon {
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Note Item */
.note-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  /* Simplify transitions to avoid heavy repaints on large lists */
  transition: background-color 150ms ease, border-color 150ms ease;
  position: relative;
  height: 60px;
  /* fixed tile height */
  min-height: 60px;
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  box-shadow: inset 0 1px 0 var(--shadow-light);
  overflow: hidden;
  /* prevent inner abs elements from poking past rounding */
  z-index: 1;
  /* Ensure glass outline is above */
}

/* Use lighter element background for cards */
.note-item {
  background: var(--bg-primary);
  /* flat surface; gradients removed */
}

/* Round corners more for top-level notes (not inside dropdown domain groups) */
.notes-list>.note-item {
  border-radius: 20px;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 10px;
  /* consistent spacing for top-level cards */
  /* Remove layered background effect */
  background: var(--bg-primary);
  position: relative;
  isolation: isolate;
  z-index: 1;
  /* Ensure glass outline is above */
}

/* Apply same rounding to notes inside dropdown domain groups */
.domain-notes-list .note-item {
  border-radius: 20px;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  background: var(--bg-primary);
  z-index: 1;
  /* Ensure glass outline is above */
}

/* Domain Group Styles */
.domain-group {
  margin-bottom: 6px;
  /* match note item spacing */
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-primary);
  /* lighter element background */
  position: relative;
  /* Remove layered background effect */
  background: var(--bg-primary);
  overflow: hidden;
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  box-shadow: inset 0 1px 0 var(--shadow-light);
  position: relative;
  isolation: isolate;
  z-index: 1;
  /* Ensure glass outline is above */
}

/* Shimmering glass outline (neutral glass) */
.note-actions .icon-btn::after,
.domain-actions .icon-btn::after,
.header .icon-btn::after,
.site-icon .icon-btn::after,
.search-wrapper::after,
.filter-wrapper::after,
.notes-list>.note-item::after,
.domain-group::after {
  content: "";
  position: absolute;
  inset: 0;
  /* sit on top of border */
  border-radius: inherit;
  pointer-events: none;
  padding: 1px;
  /* outline thickness */
  background:
    conic-gradient(from 200deg at 50% 50%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 70deg,
      rgba(0, 0, 0, 0.18) 140deg,
      rgba(255, 255, 255, 0.12) 220deg,
      rgba(255, 255, 255, 0.55) 360deg);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  /* show only ring */
  mix-blend-mode: normal;
  /* stable across themes */
  opacity: 0.9;
  z-index: 2;
  /* Ensure outline is above content */
}

/* Add glass outline to individual note items inside domain groups */
.domain-notes-list .note-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  padding: 1px;
  background:
    conic-gradient(from 200deg at 50% 50%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 70deg,
      rgba(0, 0, 0, 0.18) 140deg,
      rgba(255, 255, 255, 0.12) 220deg,
      rgba(255, 255, 255, 0.55) 360deg);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  mix-blend-mode: normal;
  opacity: 0.9;
  z-index: 2;
  /* Ensure outline is above note content */
}

/* Ensure all note items have the glass outline effect with variations */
.note-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  padding: 1px;
  background:
    conic-gradient(from 200deg at 50% 50%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 70deg,
      rgba(0, 0, 0, 0.18) 140deg,
      rgba(255, 255, 255, 0.12) 220deg,
      rgba(255, 255, 255, 0.55) 360deg);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  mix-blend-mode: normal;
  opacity: 0.9;
  z-index: 2;
  /* Ensure outline is above note content */
}

/* Vary glass outline for different note positions to avoid identical look */
.note-item:nth-child(2n)::after {
  background:
    conic-gradient(from 280deg at 45% 55%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 65deg,
      rgba(0, 0, 0, 0.20) 145deg,
      rgba(255, 255, 255, 0.12) 225deg,
      rgba(255, 255, 255, 0.55) 360deg);
  padding: 0.8px;
}

.note-item:nth-child(3n)::after {
  background:
    conic-gradient(from 140deg at 55% 45%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 75deg,
      rgba(0, 0, 0, 0.16) 155deg,
      rgba(255, 255, 255, 0.12) 235deg,
      rgba(255, 255, 255, 0.55) 360deg);
  padding: 1.2px;
}

.note-item:nth-child(4n)::after {
  background:
    conic-gradient(from 320deg at 48% 52%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 60deg,
      rgba(0, 0, 0, 0.22) 140deg,
      rgba(255, 255, 255, 0.12) 220deg,
      rgba(255, 255, 255, 0.55) 360deg);
  padding: 0.6px;
}

.note-item:nth-child(5n)::after {
  background:
    conic-gradient(from 100deg at 52% 48%,
      rgba(255, 255, 255, 0.55) 0deg,
      rgba(255, 255, 255, 0.10) 80deg,
      rgba(0, 0, 0, 0.18) 160deg,
      rgba(255, 255, 255, 0.12) 240deg,
      rgba(255, 255, 255, 0.55) 360deg);
  padding: 0.9px;
}

/* Accent-tinted glass outline for accent surfaces */
.add-note-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  padding: 0.5px;
  background:
    conic-gradient(from 200deg at 50% 50%,
      color-mix(in oklab, var(--accent-primary) 65%, white 35%) 0deg,
      color-mix(in oklab, var(--accent-primary) 20%, white 0%) 70deg,
      color-mix(in oklab, var(--accent-primary) 20%, black 60%) 140deg,
      color-mix(in oklab, var(--accent-primary) 30%, white 10%) 220deg,
      color-mix(in oklab, var(--accent-primary) 65%, white 35%) 360deg);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  mix-blend-mode: normal;
  opacity: 0.72;
}

.domain-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: color-mix(in oklab, var(--bg-tertiary) 90%, black 10%);
  /* distinct solid tone for dropdown header */
  border-left: none;
  /* remove colored left line */
  transition: background 200ms ease, color 120ms ease;
  cursor: pointer;
  list-style: none;
}

.domain-group-header:hover {
  background: color-mix(in oklab, var(--bg-tertiary) 98%, white 2%);
}

.domain-group-header::-webkit-details-marker {
  display: none;
}

.domain-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.domain-header-info span {
  font-weight: 600;
  color: var(--text-primary);
}

.domain-actions {
  display: flex;
  gap: 8px;
  /* match note actions spacing */
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

.domain-tags {
  display: none;
}

.domain-tags-right {
  display: none;
}

.domain-notes-list {
  /* Match .notes-list default padding for visual centering */
  padding: 2px 16px 8px;
}

.domain-notes-list .note-item {
  margin-bottom: 8px;
  /* a touch more spacing between cards */
}

.domain-notes-list .note-item:last-child {
  margin-bottom: 0;
}

/* Ad Container (bottom area) - styles moved to end of file */

/* Compact: make ad bar shorter so full UI fits without outer scroll */
html[data-compact="1"] .ad-placeholder {
  height: 36px;
  font-size: 11px;
}

.ad-label {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.ad-content {
  width: 100%;
  min-height: 48px;
}

.ad-placeholder {
  width: 100%;
  height: 48px;
  border: 1px dashed var(--border-color);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 12px;
}

/* Smooth scrolling globally */
html,
body {
  scroll-behavior: smooth;
}

/* Hide scrollbars but keep scrolling (cross-browser) */
/* Firefox */
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* IE/Edge legacy */
}

/* WebKit */
*::-webkit-scrollbar {
  display: none;
}

/* Notes list: remove reserved gutter and enable momentum scrolling */
.notes-list {
  scrollbar-gutter: auto !important;
  /* do not reserve space for scrollbar */
  -webkit-overflow-scrolling: touch;
  /* smooth momentum on iOS */
  padding-bottom: 80px;
  /* Add bottom padding to prevent overlap with counter */
}

/* Compact mode: adjust padding */
html[data-compact="1"] .notes-list {
  padding-bottom: 70px;
}

/* Version History Button */
.version-history-btn {
  background: var(--accent-glass-bg) !important;
  border: 1px solid var(--accent-glass-border) !important;
  box-shadow: var(--accent-glass-inset), var(--accent-glass-shadow) !important;
}

.version-history-btn:hover {
  background: var(--accent-glass-bg-hover) !important;
}

.version-history-btn svg {
  color: #fff !important;
  stroke: #fff !important;
  opacity: 1 !important;
}

/* Version History Dialog */
.version-history-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.version-history-content {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.version-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.version-history-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.version-list {
  padding: 20px;
  overflow-y: auto;
  max-height: 60vh;
}

.version-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg-secondary);
}

.version-item.current {
  border-color: var(--accent-primary);
  background: color-mix(in oklab, var(--accent-primary) 5%, var(--bg-secondary));
}

.version-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.version-number {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.version-date {
  color: var(--text-secondary);
  font-size: 12px;
}

.current-badge {
  background: var(--accent-primary);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
}

.version-preview {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.restore-btn {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.restore-btn:hover {
  background: var(--accent-secondary);
}

/* Sync Popup Styles */
.note-saved-popup {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
}

.popup-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.popup-icon {
  font-size: 16px;
  font-weight: bold;
}

.popup-message {
  font-size: 14px;
}

/* Notes Counter */
.notes-counter {
  position: absolute;
  /* Use absolute positioning within the notes container */
  bottom: 80px;
  /* Position above ads space */
  right: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-inset), var(--glass-shadow);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  font-size: 11px;
  color: var(--text-secondary);
  z-index: 100;
  /* Ensure it's above all content */
  transition: opacity 0.2s ease, bottom 0.3s ease;
  pointer-events: none;
  /* Don't interfere with scrolling */
}

/* When ads are not present (premium mode or no ads), position counter at the very bottom */
.ad-container:not(:has(.ad-content:not(.ad-placeholder)))~.notes-container .notes-counter,
.ad-container:has(.ad-content:not(.ad-placeholder):empty)~.notes-container .notes-counter,
.ad-container[style*="display: none"]~.notes-container .notes-counter {
  bottom: 16px;
}

/* Alternative check for when ad container is hidden */
body:not(:has(.ad-container:not([style*="display: none"]))) .notes-counter {
  bottom: 16px;
}

.notes-counter .counter-number {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 12px;
}

.notes-counter .counter-label {
  opacity: 0.8;
}

/* Hide counter when no notes */
.notes-counter.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Compact mode adjustments */
html[data-compact="1"] .notes-counter {
  bottom: 70px;
  /* Adjust for compact mode */
  right: 12px;
  padding: 4px 8px;
  font-size: 10px;
}

html[data-compact="1"] .notes-counter .counter-number {
  font-size: 11px;
}

/* Delete buttons: match New Note accent glass with white icon (except confirm/danger) */
.note-actions .delete-note-btn:not(.confirm):not(.danger),
.domain-actions .delete-domain-btn:not(.confirm):not(.danger) {
  background: var(--accent-glass-bg);
  border: 1px solid var(--accent-glass-border);
  box-shadow: var(--accent-glass-inset), var(--accent-glass-shadow);
}

.note-actions .delete-note-btn:not(.confirm):not(.danger):hover,
.domain-actions .delete-domain-btn:not(.confirm):not(.danger):hover {
  background: var(--accent-glass-bg-hover);
}

.note-actions .delete-note-btn:not(.confirm):not(.danger) svg,
.domain-actions .delete-domain-btn:not(.confirm):not(.danger) svg {
  color: #fff;
  stroke: #fff;
  opacity: 1;
}

/* Open/link buttons: same accent glass + white icon for visual parity */
.note-actions .open-page-btn,
.domain-actions .open-domain-btn,
.domain-actions .open-link-btn,
.domain-actions .link-btn,
.domain-actions .open-link,
/* apply directly to class in case button isn't under .domain-actions wrapper */
.open-domain-btn {
  background: var(--accent-glass-bg);
  border: 1px solid var(--accent-glass-border);
  box-shadow: var(--accent-glass-inset), var(--accent-glass-shadow);
}

.note-actions .open-page-btn:hover,
.domain-actions .open-domain-btn:hover,
.domain-actions .open-link-btn:hover,
.domain-actions .link-btn:hover,
.domain-actions .open-link:hover,
.open-domain-btn:hover {
  background: var(--accent-glass-bg-hover);
}

.note-actions .open-page-btn svg,
.domain-actions .open-domain-btn svg,
.domain-actions .open-link-btn svg,
.domain-actions .link-btn svg,
.domain-actions .open-link svg,
.open-domain-btn svg {
  color: #fff;
  stroke: #fff;
  opacity: 1;
}

/* Increase specificity so accent wins over generic .domain-actions .icon-btn base */
.icon-btn.open-domain-btn {
  background: var(--accent-glass-bg) !important;
  border: 1px solid var(--accent-glass-border) !important;
  box-shadow: var(--accent-glass-inset), var(--accent-glass-shadow) !important;
}

.icon-btn.open-domain-btn:hover {
  background: var(--accent-glass-bg-hover) !important;
}

.icon-btn.open-domain-btn svg {
  color: #fff !important;
  stroke: #fff !important;
  opacity: 1 !important;
}

/* Highest specificity fallbacks */
button.icon-btn.open-domain-btn,
.domain-actions .icon-btn.open-domain-btn {
  background: var(--accent-glass-bg) !important;
  border: 1px solid var(--accent-glass-border) !important;
  box-shadow: var(--accent-glass-inset), var(--accent-glass-shadow) !important;
}

button.icon-btn.open-domain-btn:hover,
.domain-actions .icon-btn.open-domain-btn:hover {
  background: var(--accent-glass-bg-hover) !important;
}

button.icon-btn.open-domain-btn svg,
.domain-actions .icon-btn.open-domain-btn svg {
  color: #fff !important;
  stroke: #fff !important;
  opacity: 1 !important;
}

.note-item:hover {
  /* Lightweight hover: avoid transforms and outer shadows to prevent flashing */
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
  box-shadow: inset 0 1px 0 var(--shadow-light);
}

.note-item:active {
  transform: translateY(0);
}

/* Stronger hover effects for This Page and This Site sections */
html[data-view="page"] .note-item:hover,
html[data-view="site"] .note-item:hover {
  background-color: color-mix(in oklab, var(--bg-tertiary) 80%, white 20%);
  border-color: color-mix(in oklab, var(--border-color) 70%, white 30%);
  box-shadow: inset 0 1px 0 var(--shadow-light), 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* Ensure glass outline is visible on hover */
.note-item:hover::after {
  opacity: 1;
}

/* Stronger glass outline on hover for page/site views */
html[data-view="page"] .note-item:hover::after,
html[data-view="site"] .note-item:hover::after {
  opacity: 1;
  padding: 1.5px;
}

.domain-group:hover::after {
  opacity: 1;
}

/* AI Rewrite Dialog Styles */
.ai-rewrite-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ai-rewrite-dialog .dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.ai-rewrite-dialog .dialog-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 600;
}

.ai-rewrite-dialog .close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.ai-rewrite-dialog .close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.ai-rewrite-dialog .dialog-content {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.usage-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  text-align: center;
}

.usage-text {
  margin: 0 0 4px 0;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

.usage-reset {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.context-info {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.context-info h5 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
}

.context-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.context-item {
  background: var(--accent-color);
  color: var(--text-on-accent);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.rewrite-options h4 {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
}

.rewrite-style-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.rewrite-style-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: center;
}

.rewrite-style-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

.rewrite-style-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.rewrite-preview {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  margin-top: 20px;
}

.rewrite-preview h4 {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
}

.preview-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
  color: var(--text-primary);
}

.preview-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-secondary {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-color-hover);
}

.btn-primary {
  background: var(--accent-color);
  border: 1px solid var(--accent-color);
  color: white;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--accent-color-hover);
  border-color: var(--accent-color-hover);
  transform: translateY(-1px);
}

.rewrite-loading {
  text-align: center;
  padding: 40px 20px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.rewrite-loading p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.9rem;
}

/* User Context Input Styles */
.user-context-section {
  margin-bottom: 16px;
}

.user-context-section h5 {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: white;
  opacity: 0.9;
}

.context-input-container {
  position: relative;
}

.context-input {
  width: 100%;
  min-height: 60px;
  max-height: 80px;
  padding: 16px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--glass-bg);
  color: white;
  font-size: 12px;
  line-height: 1.4;
  resize: vertical;
  transition: all 0.2s ease;
  box-shadow: var(--glass-inset);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
}

.context-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--glass-inset), 0 0 0 2px rgba(0, 122, 255, 0.2);
  background: var(--glass-bg-hover);
}

.context-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
  opacity: 0.7;
}

.char-counter {
  position: absolute;
  bottom: -25px;
  right: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  opacity: 0.8;
  background: var(--glass-bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--glass-border);
}

/* AI Dropdown Styles */
.ai-dropdown-container {
  position: relative;
  display: inline-block;
  z-index: 99999;
}

.ai-dropdown-trigger {
  position: relative;
  display: flex;
  align-items: center;
}

.ai-dropdown-trigger .dropdown-indicator {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--bg-primary);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  opacity: 0.8;
  transition: all 0.2s ease;
}

.ai-dropdown-trigger:hover .dropdown-indicator {
  opacity: 1;
  transform: scale(1.1);
}

.ai-dropdown-menu {
  position: absolute;
  width: 240px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 99999999;
  margin-top: 8px;
  pointer-events: auto;
}

.ai-dropdown-menu.show {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

/* AI Summary Modal Styles */
.ai-summary-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 999999999;
}

.ai-summary-modal.show {
  display: flex;
}

.ai-summary-content {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  width: 90%;
  max-width: 400px;
  max-height: 80%;
  overflow: hidden;
}

.ai-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
}

.ai-summary-header h3 {
  margin: 0;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
}

.ai-summary-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.ai-summary-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.ai-summary-body {
  padding: 20px;
}

.ai-summary-info {
  margin-bottom: 20px;
}

.ai-summary-info p {
  margin: 0 0 12px 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  line-height: 1.4;
}

.usage-info {
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.usage-text {
  color: white;
  font-size: 0.8rem;
  font-weight: 500;
}

.domain-selection {
  margin-bottom: 16px;
}

.domain-selection label {
  display: block;
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.summary-domain-select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
}

.summary-domain-select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.15);
}

.summary-domain-select option {
  background: var(--glass-bg);
  color: white;
  padding: 8px 12px;
}

/* Ensure dropdown arrow is visible */
.summary-domain-select::-ms-expand {
  display: none;
}

/* Custom dropdown arrow */
.summary-domain-select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.domain-info {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.domain-info p {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
}

.ai-summary-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.ai-summary-generate {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-summary-generate:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-summary-generate:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--glass-border);
}

.dropdown-header h4 {
  margin: 0;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
}

.usage-badge {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.upgrade-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upgrade-message:hover {
  transform: scale(1.05);
}

.upgrade-text {
  font-size: 0.7rem;
  font-weight: 600;
  color: #ffd700;
}

.upgrade-subtitle {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.8);
}

.style-selection {
  padding: 8px 12px;
}

.style-selection h5 {
  margin: 0 0 8px 0;
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
}

.style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.style-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.style-option:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.style-option.active {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.6);
  color: white;
}

.style-icon {
  font-size: 0.9rem;
  opacity: 0.9;
}

.style-name {
  font-size: 0.65rem;
  font-weight: 500;
  color: white;
}

.context-preview {
  padding: 0 12px 8px;
}

.context-preview h5 {
  margin: 0 0 6px 0;
  color: white;
  font-size: 0.7rem;
  font-weight: 500;
}

.context-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.context-tag {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  padding: 3px 6px;
  border-radius: 8px;
  font-size: 0.6rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dropdown-actions {
  padding: 0 12px 8px;
}

.dropdown-actions .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 6px 12px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
}

.dropdown-actions .btn-primary:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Multi-highlight button */
.multi-highlight-btn {
  background: var(--primary-color, #3b82f6);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
}

.multi-highlight-btn:hover {
  background: var(--primary-hover, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.multi-highlight-btn.active {
  background: var(--success-color, #10b981);
  box-shadow: 0 0 0 2px var(--success-color, #10b981);
}

.multi-highlight-btn.active:hover {
  background: var(--success-hover, #059669);
}

/* Settings button */

/* Citation Feature Styles */
.citation-container {
  position: relative;
  display: inline-block;
}

.citation-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  min-width: 32px;
  height: 32px;
}

.citation-btn .dropdown-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--bg-primary);
  border-radius: 50%;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  opacity: 0.8;
  transition: all 0.2s ease;
}

.citation-btn:hover .dropdown-indicator {
  opacity: 1;
  transform: scale(1.1);
}

.citation-dropdown {
  position: fixed;
  /* Changed from absolute to fixed for body positioning */
  width: 180px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-shadow), 0 8px 24px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  overflow: hidden;
  z-index: 99999999;
  /* Increased z-index to match color picker */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.citation-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.citation-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
}

.citation-header h5 {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.citation-formats {
  padding: 8px;
}

.citation-format-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
}

.citation-format-btn:last-child {
  margin-bottom: 0;
}

.citation-format-btn:hover {
  background: var(--glass-bg-hover);
  border-color: color-mix(in oklab, var(--border-color) 60%, rgba(255, 255, 255, 0.32));
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 3px 10px rgba(0, 0, 0, 0.09);
}

.citation-format-btn:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 0 var(--shadow-light);
}

/* Close citation dropdown when clicking outside */
.citation-dropdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99998;
  background: transparent;
}

/* Ensure citation button shows in the formatting toolbar */
.formatting-toolbar .citation-container {
  margin-left: 8px;
}

/* Ad Container Styles */
.ad-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 6px 8px;
  backdrop-filter: blur(var(--backdrop-blur));
  -webkit-backdrop-filter: blur(var(--backdrop-blur));
  z-index: 1000;
  box-shadow: 0 -2px 8px var(--shadow-dark);
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.ad-container:not(.show) {
  transform: translateY(100%);
}

.ad-content {
  max-width: 336px;
  margin: 0 auto;
  width: 100%;
}

/* Ensure popup content doesn't get cut off by ad */
.app-container {
  padding-bottom: 0;
}

.app-container:has(.ad-container.show) {
  padding-bottom: 70px;
}

/* Alternative for browsers that don't support :has() */
.notes-container {
  margin-bottom: 0;
  transition: margin-bottom 0.3s ease;
}

body:has(.ad-container.show) .notes-container {
  /* margin-bottom: 70px; - removed as requested */
}

/* Responsive ad styles */
@media (max-width: 400px) {
  .ad-container {
    padding: 4px 6px;
  }

  .ad-content {
    max-width: 100%;
  }

  .nordvpn-banner {
    max-height: 50px;
  }

  .fallback-ad {
    padding: 6px 8px !important;
    gap: 6px !important;
  }

  .fallback-ad .ad-text strong {
    font-size: 11px !important;
  }

  .fallback-ad .ad-text p {
    font-size: 10px !important;
  }

  .upgrade-btn {
    padding: 4px 8px !important;
    font-size: 10px !important;
  }
}