    :root {
      --bg-app: #06080F;
      --bg-sidebar: rgba(8, 11, 19, 0.92);
      --bg-header: rgba(8, 11, 19, 0.65);
      --bg-panel: rgba(13, 17, 29, 0.82);
      --bg-subtle: rgba(255, 255, 255, 0.045);
      --bg-subtle-hover: rgba(255, 255, 255, 0.09);
      --bg-canvas: #05070D;
      --bg-code: #04060B;
      --border-subtle: rgba(255, 255, 255, 0.08);
      --text-strong: #F8FAFC;
      --text-body: #E2E8F0;
      --text-muted: #94A3B8;
      --text-faint: #64748B;
      color-scheme: dark;
    }

    html[data-theme="light"] {
      --bg-app: #F8FAFC;
      --bg-sidebar: #FFFFFF;
      --bg-header: rgba(255, 255, 255, 0.86);
      --bg-panel: rgba(255, 255, 255, 0.96);
      --bg-subtle: rgba(15, 23, 42, 0.045);
      --bg-subtle-hover: rgba(15, 23, 42, 0.09);
      --bg-canvas: #FFFFFF;
      --bg-code: #F1F5F9;
      --border-subtle: rgba(15, 23, 42, 0.1);
      --text-strong: #0F172A;
      --text-body: #1E293B;
      --text-muted: #475569;
      --text-faint: #64748B;
      color-scheme: light;
    }

    * { box-sizing: border-box; }
    body {
      margin: 0;
      background-color: var(--bg-app);
      color: var(--text-body);
      font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      overflow: hidden;
      transition: background-color 0.2s ease, color 0.2s ease;
    }
    .font-mono-code { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace; }
    .app-sidebar { background: var(--nx-sidebar, var(--bg-sidebar)); border-color: var(--nx-border, var(--border-subtle)); }
    .app-header { background: var(--nx-header, var(--bg-header)); border-color: var(--nx-border, var(--border-subtle)); }
    .glass-panel {
      background: var(--nx-surface, var(--bg-panel));
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid var(--nx-border, var(--border-subtle));
    }
    .theme-surface { background: var(--bg-subtle); border: 1px solid var(--border-subtle); color: var(--text-body); }
    .theme-surface:hover { background: var(--bg-subtle-hover); }
    .theme-strong { color: var(--nx-fg, var(--text-strong)); }
    .theme-muted { color: var(--nx-fg-muted, var(--text-muted)); }
    .theme-faint { color: var(--nx-fg-faint, var(--text-faint)); }
    .theme-border { border-color: var(--nx-border, var(--border-subtle)); }
    .theme-canvas { background: var(--nx-canvas, var(--bg-canvas)); border: 1px solid var(--nx-border, var(--border-subtle)); }
    .theme-code { background: var(--nx-code, var(--bg-code)); border: 1px solid var(--nx-border, var(--border-subtle)); }
    .theme-input {
      background: var(--nx-elev, var(--bg-subtle));
      border: 1px solid var(--nx-border, var(--border-subtle));
      color: var(--nx-fg, var(--text-strong));
    }

    /* Clean, borderless Notion/Linear-grade Sidebar & Header controls */
    .nx-sb-item {
      width: 100%;
      display: flex;
      align-items: center;
      gap: 9px;
      padding: 7px 10px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 500;
      color: var(--nx-fg-muted);
      background: transparent;
      border: 1px solid transparent;
      text-align: left;
      cursor: pointer;
      transition: background-color 0.14s ease, color 0.14s ease;
    }
    .nx-sb-item:hover {
      background: color-mix(in srgb, var(--nx-fg) 6%, transparent);
      color: var(--nx-fg);
    }
    .nx-sb-item.is-active {
      background: color-mix(in srgb, var(--nx-fg) 9%, transparent);
      color: var(--nx-fg);
      font-weight: 600;
    }

    .nx-icon-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 7px;
      color: var(--nx-fg-muted);
      background: transparent;
      border: 1px solid transparent;
      cursor: pointer;
      transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
    }
    .nx-icon-btn:hover {
      background: color-mix(in srgb, var(--nx-fg) 7%, transparent);
      color: var(--nx-fg);
    }

    .nx-top-btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      height: 30px;
      padding: 0 10px;
      border-radius: 7px;
      font-size: 12px;
      font-weight: 500;
      color: var(--nx-fg-body);
      background: transparent;
      border: 1px solid transparent;
      cursor: pointer;
      transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
    }
    .nx-top-btn:hover {
      background: color-mix(in srgb, var(--nx-fg) 7%, transparent);
      color: var(--nx-fg);
    }

    /* Desktop Collapsible Left Panel (>= 1024px) */
    @media (min-width: 1024px) {
      #studio-sidebar {
        width: 256px;
        transition: width 0.22s cubic-bezier(0.22, 1, 0.36, 1),
                    opacity 0.18s ease,
                    border-color 0.22s ease;
        overflow: hidden;
      }
      #studio-sidebar > .nx-sidebar-inner {
        width: 256px;
        min-width: 256px;
      }
      body.sidebar-collapsed #studio-sidebar {
        width: 0 !important;
        opacity: 0;
        border-right-width: 0 !important;
        pointer-events: none;
      }
    }

    .nx-kb-chevron {
      transition: transform 0.18s ease;
    }
    .nx-kb-collapsed .nx-kb-chevron {
      transform: rotate(-90deg);
    }

    /* Tools & Page Popover Dropdowns */
    #header-tools-dropdown summary::-webkit-details-marker,
    #note-actions-dropdown summary::-webkit-details-marker {
      display: none;
    }
    #header-tools-dropdown summary,
    #note-actions-dropdown summary {
      list-style: none;
    }
    details:not([open]) > *:not(summary) {
      display: none !important;
    }

    .hidden {
      display: none !important;
    }

    #sidebar-signed-in.is-active {
      background: color-mix(in srgb, var(--nx-fg) 8%, transparent);
    }

    /* Unified Carbon & Paper Chips, Badges & Consistent Icon Sizing */
    .nx-icon-sm {
      width: 13.5px;
      height: 13.5px;
      stroke-width: 1.8;
      flex-shrink: 0;
      display: inline-block;
    }

    .nx-chip-btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      height: 30px;
      padding: 0 10px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 500;
      background: var(--nx-elev);
      border: 1px solid var(--nx-border);
      color: var(--nx-fg-body);
      cursor: pointer;
      transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
    }
    .nx-chip-btn:hover {
      background: var(--nx-elev-hover);
      border-color: var(--nx-border-strong);
      color: var(--nx-fg);
    }
    .nx-chip-btn.is-active {
      background: var(--nx-primary-bg);
      color: var(--nx-primary-fg);
      border-color: transparent;
      font-weight: 600;
    }

    .nx-badge-muted {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 2px 8px;
      border-radius: 9999px;
      font-size: 11px;
      font-weight: 500;
      background: color-mix(in srgb, var(--nx-fg) 6%, transparent);
      border: 1px solid var(--nx-border);
      color: var(--nx-fg-muted);
    }

    .nx-badge-accent {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 2px 8px;
      border-radius: 9999px;
      font-size: 11px;
      font-weight: 600;
      background: var(--nx-accent-soft);
      border: 1px solid color-mix(in srgb, var(--nx-accent) 36%, transparent);
      color: var(--nx-accent);
    }

    .nx-link-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 10px;
      border-radius: 9999px;
      font-size: 12px;
      font-weight: 500;
      background: var(--nx-elev);
      border: 1px solid var(--nx-border);
      color: var(--nx-fg-body);
      transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
    }
    .nx-link-chip:hover {
      background: var(--nx-elev-hover);
      border-color: var(--nx-border-strong);
      color: var(--nx-fg);
    }

    html[data-theme="light"] .light-pill-active {
      background: rgba(124, 58, 237, 0.12) !important;
      color: #5B21B6 !important;
      border-color: rgba(124, 58, 237, 0.3) !important;
    }
    html[data-theme="light"] .light-callout {
      background: #FEF3C7 !important;
      border-color: #F59E0B !important;
      color: #78350F !important;
    }
    html[data-theme="light"] .light-callout textarea { color: #78350F !important; }
    html[data-theme="light"] .light-code-text { color: #047857 !important; }
    html[data-theme="light"] .light-tag-pill {
      background: rgba(255, 255, 255, 0.85) !important;
      color: #1E293B !important;
      border-color: rgba(15, 23, 42, 0.14) !important;
    }

    .block-row:hover .block-actions { opacity: 1; }
    .nx-page-row { position: relative; }
    .nx-page-row .nx-page-del-btn {
      opacity: 0;
      transition: opacity 0.14s ease, color 0.14s ease, background-color 0.14s ease;
    }
    .nx-page-row:hover .nx-page-del-btn,
    .nx-page-row:focus-within .nx-page-del-btn { opacity: 1; }

    /* Hybrid Fluid vs Paged Sheet Editor Modes & Paper Rulings (Saber / Xournal++ / Rnote inspired) */
    #studio-content-shell,
    #mode-notes {
      min-width: 0;
    }
    #notes-signed-out-state {
      width: 100%;
      max-width: min(var(--nx-sheet-measure, 62rem), 100%);
      margin: 0 auto 2px auto;
      padding: 4px var(--nx-margin-right, 36px) 8px var(--nx-margin-left, 36px);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      border-bottom: 1px solid color-mix(in srgb, var(--nx-fg, #F3F0E8) 7%, transparent);
      background: transparent;
      box-sizing: border-box;
    }
    @media (max-width: 640px) {
      #notes-signed-out-state {
        padding: 0 16px 8px 16px;
      }
    }
    .nx-guest-sync-link {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      height: 26px;
      padding: 0 9px;
      border-radius: 7px;
      font-size: 11.5px;
      font-weight: 500;
      color: var(--nx-fg-muted, var(--text-muted));
      background: transparent;
      border: 1px solid color-mix(in srgb, var(--nx-fg, #F3F0E8) 10%, transparent);
      cursor: pointer;
      white-space: nowrap;
      transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
    }
    .nx-guest-sync-link:hover {
      background: color-mix(in srgb, var(--nx-fg, #F3F0E8) 6%, transparent);
      border-color: color-mix(in srgb, var(--nx-fg, #F3F0E8) 18%, transparent);
      color: var(--nx-fg, var(--text-strong));
    }
    #notes-sheet-wrap {
      position: relative;
      width: 100%;
      box-sizing: border-box;
      overflow-x: clip;
      --nx-margin-top: 32px;
      --nx-margin-right: 36px;
      --nx-margin-bottom: 48px;
      --nx-margin-left: 36px;
      --nx-margin-rule-color: rgba(244, 63, 94, 0.36);
    }
    #notes-sheet-wrap:has(#note-actions-dropdown[open]),
    #notes-sheet-wrap.has-open-menu {
      overflow: visible !important;
    }
    /* Drawing surface always fills the visible page and grows to fit the lowest placed item */
    #notes-sheet-wrap {
      min-height: max(560px, calc(100dvh - 150px), var(--nx-spatial-min, 0px));
    }
    .nx-page-header-row {
      position: relative;
      z-index: 32;
    }
    .nx-page-header-row:has(#note-actions-dropdown[open]),
    .nx-page-header-row.has-open-menu {
      z-index: 50 !important;
    }
    #notes-sheet-wrap,
    .nx-book-scroll-sheet {
      width: 100%;
      box-sizing: border-box;
      --nx-eff-margin-top: var(--nx-margin-top, 32px);
      --nx-eff-margin-right: var(--nx-margin-right, 36px);
      --nx-eff-margin-bottom: var(--nx-margin-bottom, 48px);
      --nx-eff-margin-left: var(--nx-margin-left, 36px);
    }
    .nx-sheet-fluid {
      width: 100%;
      max-width: min(var(--nx-sheet-measure, 62rem), 100%);
      margin-left: auto;
      margin-right: auto;
      padding: var(--nx-eff-margin-top) var(--nx-eff-margin-right) var(--nx-eff-margin-bottom) var(--nx-eff-margin-left);
      background: transparent;
      border: 1px solid transparent;
    }
    .nx-sheet-paged-a4,
    .nx-sheet-paged-letter,
    .nx-sheet-paged-tablet,
    .nx-sheet-paged-wide,
    .nx-sheet-paged-a4-landscape,
    .nx-sheet-book-spread {
      position: relative;
      width: 100%;
      box-sizing: border-box;
      margin-left: auto;
      margin-right: auto;
      padding: var(--nx-eff-margin-top) var(--nx-eff-margin-right) var(--nx-eff-margin-bottom) var(--nx-eff-margin-left);
      border-radius: 14px;
      background: #161614;
      border: 1px solid rgba(255, 255, 255, 0.10);
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.42);
    }
    .nx-sheet-paged-a4 { max-width: min(794px, 100%); min-height: 980px; }
    .nx-sheet-paged-letter { max-width: min(816px, 100%); min-height: 960px; }
    .nx-sheet-paged-tablet { max-width: min(768px, 100%); min-height: 900px; }
    .nx-sheet-paged-wide { max-width: min(1056px, 100%); min-height: 620px; }
    .nx-sheet-paged-a4-landscape { max-width: min(1056px, 100%); min-height: 746px; }
    .nx-sheet-book-spread {
      max-width: min(1120px, 100%);
      min-height: 760px;
      box-shadow: 0 24px 60px rgba(0, 0, 0, 0.48), inset 0 0 0 1px rgba(255,255,255,0.06);
    }
    .nx-sheet-book-spread::before {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      left: 50%;
      width: 24px;
      transform: translateX(-50%);
      background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.24) 48%, rgba(255, 255, 255, 0.06) 52%, transparent);
      pointer-events: none;
      z-index: 2;
    }
    html[data-theme="light"] .nx-sheet-paged-a4,
    html[data-theme="light"] .nx-sheet-paged-letter,
    html[data-theme="light"] .nx-sheet-paged-tablet,
    html[data-theme="light"] .nx-sheet-paged-wide,
    html[data-theme="light"] .nx-sheet-paged-a4-landscape,
    html[data-theme="light"] .nx-sheet-book-spread {
      background: #FAF8F4;
      border-color: rgba(20, 20, 19, 0.12);
      box-shadow: 0 16px 42px rgba(20, 20, 19, 0.09);
    }
    @media (min-width: 641px) {
      #notes-sheet-wrap.nx-paper-cornell,
      .nx-book-scroll-sheet.nx-paper-cornell {
        --nx-eff-margin-left: max(var(--nx-margin-left, 56px), 210px);
      }
    }
    @media (max-width: 640px) {
      #notes-sheet-wrap,
      .nx-book-scroll-sheet {
        --nx-eff-margin-top: max(18px, calc(var(--nx-margin-top, 32px) * 0.55));
        --nx-eff-margin-right: max(16px, calc(var(--nx-margin-right, 32px) * 0.5));
        --nx-eff-margin-bottom: max(24px, calc(var(--nx-margin-bottom, 48px) * 0.55));
        --nx-eff-margin-left: max(16px, calc(var(--nx-margin-left, 32px) * 0.5));
      }
      #notes-sheet-wrap.has-left-margin-rule,
      .nx-book-scroll-sheet.has-left-margin-rule {
        --nx-eff-margin-left: max(26px, calc(var(--nx-margin-left, 56px) * 0.48));
      }
      .nx-sheet-paged-a4,
      .nx-sheet-paged-letter,
      .nx-sheet-paged-tablet {
        min-height: 540px;
      }
    }

    /* Academic Paper Templates */
    .nx-paper-ruled {
      background-image:
        repeating-linear-gradient(to bottom, transparent 0, transparent 27px, rgba(148, 163, 184, 0.15) 27px, rgba(148, 163, 184, 0.15) 28px);
      background-origin: border-box;
      background-position: 0 var(--nx-eff-margin-top);
    }
    .nx-paper-cornell {
      background-image:
        linear-gradient(to right, transparent 196px, rgba(200, 147, 90, 0.34) 196px, rgba(200, 147, 90, 0.34) 198px, transparent 198px),
        repeating-linear-gradient(to bottom, transparent 0, transparent 27px, rgba(148, 163, 184, 0.13) 27px, rgba(148, 163, 184, 0.13) 28px);
      background-position: 0 0, 0 var(--nx-eff-margin-top);
    }
    .nx-paper-squared {
      background-size: 24px 24px;
      background-image:
        linear-gradient(to right, rgba(148, 163, 184, 0.13) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(148, 163, 184, 0.13) 1px, transparent 1px);
    }
    .nx-paper-dotted {
      background-size: 22px 22px;
      background-image: radial-gradient(circle, rgba(148, 163, 184, 0.28) 1.15px, transparent 1.15px);
    }
    .nx-paper-isometric {
      background-size: 28px 48px;
      background-image:
        linear-gradient(30deg, rgba(148, 163, 184, 0.12) 1px, transparent 1px),
        linear-gradient(150deg, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
    }
    .nx-paper-music {
      background-size: 100% 72px;
      background-image:
        linear-gradient(to bottom,
          transparent 18px,
          rgba(148, 163, 184, 0.22) 18px, rgba(148, 163, 184, 0.22) 19px,
          transparent 19px, transparent 26px,
          rgba(148, 163, 184, 0.22) 26px, rgba(148, 163, 184, 0.22) 27px,
          transparent 27px, transparent 34px,
          rgba(148, 163, 184, 0.22) 34px, rgba(148, 163, 184, 0.22) 35px,
          transparent 35px, transparent 42px,
          rgba(148, 163, 184, 0.22) 42px, rgba(148, 163, 184, 0.22) 43px,
          transparent 43px, transparent 50px,
          rgba(148, 163, 184, 0.22) 50px, rgba(148, 163, 184, 0.22) 51px,
          transparent 51px);
    }

    /* Live Margin Guides & Rule Lines on Book Sheet */
    .nx-margin-guide-box {
      position: absolute;
      top: calc(var(--nx-eff-margin-top) - 8px);
      right: calc(var(--nx-eff-margin-right) - 8px);
      bottom: calc(var(--nx-eff-margin-bottom) - 8px);
      left: calc(var(--nx-eff-margin-left) - 8px);
      border: 1px dashed rgba(148, 163, 184, 0.16);
      border-radius: 6px;
      pointer-events: none;
      z-index: 1;
    }
    html[data-theme="light"] .nx-margin-guide-box {
      border-color: rgba(20, 20, 19, 0.09);
    }
    .nx-margin-rule-line {
      position: absolute;
      top: 0;
      bottom: 0;
      width: 1.5px;
      background: var(--nx-margin-rule-color, rgba(244, 63, 94, 0.42));
      pointer-events: none;
      z-index: 2;
    }
    .nx-margin-rule-left-pos,
    #page-margin-rule-left {
      left: calc(var(--nx-eff-margin-left) - 12px);
    }
    .nx-margin-rule-right-pos,
    #page-margin-rule-right {
      right: calc(var(--nx-eff-margin-right) - 12px);
    }

    /* Organized Book Spatial Elements & Full-Page Ink Overlay */
    #page-spatial-layer {
      position: absolute;
      inset: 0;
      pointer-events: none;
      z-index: 34;
      overflow: hidden;
      border-radius: inherit;
    }
    .nx-spatial-el {
      position: absolute;
      pointer-events: auto;
      border-radius: 10px;
      border: 1px solid var(--nx-border-strong, rgba(28, 25, 23, 0.14));
      transition: box-shadow 0.12s ease, border-color 0.12s ease;
    }
    .nx-spatial-el.glass-panel {
      background: var(--nx-surface, #1C1B19) !important;
      backdrop-filter: none !important;
      -webkit-backdrop-filter: none !important;
    }
    [data-theme="light"] .nx-spatial-el.glass-panel {
      background: #FFFFFF !important;
      border-color: rgba(28, 25, 23, 0.16);
      box-shadow: 0 8px 24px rgba(28, 25, 23, 0.08);
    }
    .nx-spatial-el:hover {
      border-color: rgba(200, 147, 90, 0.5);
    }
    .nx-spatial-el.is-selected {
      border-color: var(--nx-accent, #C8935A) !important;
      box-shadow: 0 0 0 2px rgba(200, 147, 90, 0.26), 0 12px 28px rgba(0, 0, 0, 0.28);
      z-index: 25 !important;
    }
    .nx-spatial-drag-bar {
      cursor: grab;
      touch-action: none;
      user-select: none;
    }
    .nx-spatial-drag-bar:active {
      cursor: grabbing;
    }
    .nx-spatial-resize-handle {
      position: absolute;
      right: -5px;
      bottom: -5px;
      width: 14px;
      height: 14px;
      border-radius: 4px;
      background: var(--nx-accent, #C8935A);
      border: 2px solid #FFFFFF;
      cursor: nwse-resize;
      touch-action: none;
      opacity: 0;
      transition: opacity 0.12s ease;
    }
    .nx-spatial-el:hover .nx-spatial-resize-handle,
    .nx-spatial-el.is-selected .nx-spatial-resize-handle {
      opacity: 1;
    }
    #page-ink-overlay {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 18;
      touch-action: none;
      border-radius: inherit;
    }
    #page-ink-overlay.is-drawing-active {
      pointer-events: auto;
      z-index: 28;
      cursor: crosshair;
    }

    /* Continuous Scrollable Book Sheet Cards & Floating Bottom Ink Dock */
    .nx-book-scroll-sheet {
      position: relative;
      cursor: text;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }
    .nx-book-scroll-sheet:hover {
      border-color: color-mix(in srgb, var(--nx-fg) 22%, transparent);
    }
    .nx-page-floating-dock {
      position: fixed;
      left: 50%;
      bottom: calc(20px + var(--safe-bottom, 0px));
      transform: translateX(-50%);
      z-index: 46;
      padding: 6px;
      border-radius: 18px;
      background: var(--nx-bg-elevated, #161614);
      border: 1px solid var(--nx-border-strong, rgba(255, 255, 255, 0.14));
      box-shadow: 0 22px 48px -12px rgba(0, 0, 0, 0.5);
      max-width: calc(100vw - 16px);
      display: flex;
      align-items: center;
    }
    @media (min-width: 768px) {
      .nx-page-floating-dock {
        left: calc(50% + 124px);
      }
      body.sidebar-collapsed .nx-page-floating-dock {
        left: 50%;
      }
    }
    html[data-theme="light"] .nx-page-floating-dock {
      background: #FFFFFF;
      border-color: rgba(20, 20, 19, 0.13);
      box-shadow: 0 20px 44px -12px rgba(20, 20, 19, 0.18);
    }
    .nx-page-floating-dock.hidden,
    .nx-page-dock-popover.hidden,
    .nx-page-shape-popover.hidden,
    .nx-page-margins-popover.hidden {
      display: none !important;
    }
    .nx-page-dock-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      min-width: 36px;
      height: 36px;
      padding: 0 9px;
      border-radius: 11px;
      font-size: 12px;
      font-weight: 500;
      color: var(--nx-fg-muted, var(--text-muted));
      background: transparent;
      border: 1px solid transparent;
      white-space: nowrap;
      cursor: pointer;
      transition: background-color 0.13s ease, color 0.13s ease, border-color 0.13s ease;
    }
    .nx-page-dock-btn:hover {
      background: color-mix(in srgb, var(--nx-fg) 6%, transparent);
      color: var(--nx-fg, var(--text-strong));
    }
    .nx-page-dock-btn.is-active {
      background: color-mix(in srgb, var(--nx-fg) 11%, transparent);
      border-color: color-mix(in srgb, var(--nx-fg) 14%, transparent);
      color: var(--nx-fg, var(--text-strong));
      font-weight: 600;
    }
    .nx-dock-sm-only {
      display: none;
    }
    @media (min-width: 640px) {
      .nx-dock-sm-only {
        display: inline-flex;
      }
    }
    .nx-dock-xl-label {
      display: none;
    }
    @media (min-width: 1280px) {
      .nx-dock-xl-label {
        display: inline;
      }
    }
    .nx-page-dock-popover {
      position: absolute;
      left: 50%;
      bottom: calc(100% + 10px);
      transform: translateX(-50%);
      width: 336px;
      max-width: calc(100vw - 24px);
      z-index: 50;
    }
    .nx-page-shape-popover {
      position: absolute;
      left: 50%;
      bottom: calc(100% + 10px);
      transform: translateX(-50%);
      padding: 6px 8px;
      border-radius: 14px;
      background: var(--nx-bg-elevated, #161614);
      border: 1px solid var(--nx-border-strong, rgba(255, 255, 255, 0.14));
      box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.45);
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 5px;
      width: max-content;
      max-width: calc(100vw - 24px);
      z-index: 50;
    }
    html[data-theme="light"] .nx-page-shape-popover {
      background: #FFFFFF;
      border-color: rgba(20, 20, 19, 0.13);
      box-shadow: 0 18px 40px -12px rgba(20, 20, 19, 0.16);
    }
    .nx-page-margins-popover {
      position: fixed;
      right: 20px;
      top: 68px;
      width: 320px;
      max-width: calc(100vw - 24px);
      padding: 14px;
      border-radius: 18px;
      background: var(--nx-bg-elevated, #161614);
      border: 1px solid var(--nx-border-strong, rgba(255, 255, 255, 0.14));
      box-shadow: 0 24px 52px -12px rgba(0, 0, 0, 0.5);
      z-index: 67;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    html[data-theme="light"] .nx-page-margins-popover {
      background: #FFFFFF;
      border-color: rgba(20, 20, 19, 0.13);
      box-shadow: 0 22px 48px -12px rgba(20, 20, 19, 0.18);
    }
    @media (max-width: 767px) {
      .nx-page-floating-dock {
        bottom: calc(74px + var(--safe-bottom, 0px));
        padding: 5px;
      }
      .nx-page-dock-btn {
        min-width: 34px;
        height: 34px;
        padding: 0 7px;
      }
      .nx-page-margins-popover {
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        top: auto;
        bottom: calc(76px + var(--safe-bottom, 0px));
      }
    }

    /* Book Page Tiles Light-Table Grid */
    .nx-book-tile-card {
      position: relative;
      border-radius: 14px;
      border: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-elev, rgba(255, 255, 255, 0.04));
      padding: 10px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
    }
    .nx-book-tile-card:hover {
      transform: translateY(-2px);
      border-color: rgba(200, 147, 90, 0.55);
      box-shadow: 0 14px 30px rgba(0, 0, 0, 0.26);
    }
    .nx-book-tile-card.is-current-page {
      border-color: var(--nx-accent, #C8935A);
      box-shadow: 0 0 0 2px rgba(200, 147, 90, 0.25);
    }
    .nx-book-tile-sheet {
      position: relative;
      width: 100%;
      border-radius: 8px;
      background: #161614;
      border: 1px solid rgba(255, 255, 255, 0.1);
      overflow: hidden;
      cursor: pointer;
    }
    html[data-theme="light"] .nx-book-tile-sheet {
      background: #FAF8F4;
      border-color: rgba(15, 23, 42, 0.14);
    }

    @media (max-width: 767px) {
      #mode-notes input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
      #mode-notes textarea,
      #mode-notes select,
      #nexus-modals-root input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
      #nexus-modals-root textarea,
      #nexus-modals-root select {
        font-size: max(16px, var(--nx-user-font-size, 16px)) !important;
      }
    }

    /* Carbon & Paper Typography, Open-Source Fonts, Languages & Line Spacing Popover */
    .nx-typography-popover {
      position: fixed;
      top: 72px;
      right: 24px;
      z-index: 68;
      width: 348px;
      max-width: calc(100vw - 20px);
      max-height: calc(100dvh - 96px);
      overflow-y: auto;
      overflow-x: hidden;
      padding: 14px;
      border-radius: 18px;
      background: rgba(20, 20, 19, 0.97);
      border: 1px solid rgba(255, 255, 255, 0.14);
      box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.65);
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    html[data-theme="light"] .nx-typography-popover {
      background: rgba(252, 251, 248, 0.98);
      border-color: rgba(20, 20, 19, 0.14);
      box-shadow: 0 22px 54px -12px rgba(15, 23, 42, 0.22);
    }
    .nx-typography-popover.hidden {
      display: none !important;
    }
    .nx-typography-popover input[type="range"] {
      accent-color: #D99B52;
    }
    @media (max-width: 639px) {
      .nx-typography-popover {
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 86dvh !important;
        border-radius: 22px 22px 0 0 !important;
        padding: 12px 16px calc(18px + env(safe-area-inset-bottom, 0px)) !important;
      }
    }
    .nx-typo-seg {
      display: grid;
      gap: 4px;
      padding: 3px;
      border-radius: 11px;
      background: rgba(128, 128, 128, 0.1);
      border: 1px solid rgba(128, 128, 128, 0.14);
    }
    .nx-typo-seg-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .nx-typo-seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .nx-typo-seg-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .nx-typo-seg > button {
      min-height: 30px;
      padding: 4px 6px;
      border-radius: 8px;
      font-size: 11px;
      font-weight: 500;
      border: 1px solid transparent;
      background: transparent;
      color: inherit;
      opacity: 0.76;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      min-width: 0;
      transition: background-color .14s ease, opacity .14s ease;
    }
    .nx-typo-seg > button:hover { opacity: 1; }
    .nx-typo-seg > button.is-active {
      background: #F3F0E8;
      color: #0E0E0D;
      font-weight: 600;
      opacity: 1;
    }
    html[data-theme="light"] .nx-typo-seg > button.is-active {
      background: #171614;
      color: #F6F4EE;
    }
    .nx-title-textarea {
      display: block;
      width: 100%;
      max-width: 100%;
      resize: none;
      overflow: hidden;
      background: transparent;
      border: none;
      padding: 0;
      margin: 0;
      line-height: 1.2;
      box-sizing: border-box;
      white-space: pre-wrap;
      overflow-wrap: break-word;
      word-break: normal;
    }
    #blocks-container {
      width: 100%;
      max-width: 100%;
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    .block-row {
      position: relative;
      display: flex;
      align-items: flex-start;
      gap: 10px;
      width: 100%;
      max-width: 100%;
      margin: 0;
      padding: 2px 0;
      box-sizing: border-box;
    }
    .nx-block-textarea {
      display: block;
      flex: 1 1 0%;
      min-width: 0;
      width: 100%;
      max-width: 100%;
      resize: none;
      overflow: hidden;
      background: transparent;
      border: none;
      padding: 0;
      margin: 0;
      box-sizing: border-box;
      white-space: pre-wrap;
      overflow-wrap: break-word;
      word-break: normal;
    }
    .nx-block-textarea:focus {
      outline: none;
    }
    .block-row > .block-actions {
      position: absolute;
      right: 0;
      top: -26px;
      z-index: 26;
      display: inline-flex;
      align-items: center;
      gap: 2px;
      padding: 2px 4px;
      border-radius: 9px;
      background: var(--nx-bg-elevated, #181816);
      border: 1px solid var(--nx-border-strong, rgba(255, 255, 255, 0.14));
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
      opacity: 0;
      pointer-events: none;
      transform: translateY(2px);
      transition: opacity 0.14s ease, transform 0.14s ease;
    }
    html[data-theme="light"] .block-row > .block-actions {
      background: #FFFFFF;
      border-color: rgba(20, 20, 19, 0.14);
      box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    }
    .block-row:hover > .block-actions,
    .block-row:focus-within > .block-actions {
      opacity: 1;
      pointer-events: auto;
      transform: translateY(0);
    }

    /* Tactile Book Cover Card Art */
    .nx-book-cover {
      position: relative;
      border-radius: 10px 14px 14px 10px;
      overflow: hidden;
      box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.14);
      transition: transform 0.18s ease, box-shadow 0.18s ease;
    }
    .nx-book-cover:hover {
      transform: translateY(-2px);
      box-shadow: 0 18px 34px rgba(0, 0, 0, 0.42);
    }
    .nx-book-spine {
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 18px;
      box-shadow: inset -2px 0 6px rgba(0, 0, 0, 0.35);
    }

    /* Bulletproof Viewport-Clamped Scrollable Modals (Desktop, Laptop, Tablet & Phone) */
    #nexus-modals-root > .fixed.inset-0 {
      overflow-y: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      align-items: safe center;
      padding: max(12px, env(safe-area-inset-top, 0px)) 12px max(12px, env(safe-area-inset-bottom, 0px)) 12px;
    }
    #nexus-modals-root > .fixed.inset-0 > div {
      margin: auto;
    }
    #nexus-modals-root > .fixed.inset-0 > div:not(.nx-modal-shell) {
      max-height: calc(100vh - 32px);
      overflow-y: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
    }
    .nx-modal-shell {
      display: flex;
      flex-direction: column;
      width: 100%;
      max-height: min(88vh, 820px);
      margin: auto;
      overflow: hidden;
    }
    @supports (height: 100dvh) {
      #nexus-modals-root > .fixed.inset-0 > div:not(.nx-modal-shell) {
        max-height: calc(100dvh - 32px);
      }
      .nx-modal-shell {
        max-height: min(88dvh, 820px);
      }
    }
    .nx-modal-scroll-body {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      overflow-x: hidden;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
      padding-right: 4px;
    }

    /* Notion/Craft-Caliber Single '+' Trigger & Carbon & Paper Insert Popover (Zero Button-Row Clutter) */
    .nx-quiet-insert-bar {
      position: relative;
      z-index: 24;
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 4px 0;
      min-height: 36px;
      width: 100%;
      box-sizing: border-box;
    }
    .nx-quiet-insert-bar:has(#note-block-insert-popover:not(.hidden)),
    .nx-quiet-insert-bar.is-insert-open {
      z-index: 50;
    }
    .nx-plus-trigger {
      width: 30px;
      height: 30px;
      min-width: 30px;
      min-height: 30px;
      border-radius: 999px;
      border: 1px solid var(--nx-border, var(--border-subtle));
      background: transparent;
      color: var(--nx-fg-faint, var(--text-faint));
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
      transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
    }
    .nx-plus-trigger:hover,
    .nx-plus-trigger[aria-expanded="true"] {
      background: var(--nx-elev, var(--bg-subtle));
      border-color: var(--nx-border-strong, var(--border-subtle));
      color: var(--nx-fg, var(--text-strong));
    }
    .nx-plus-trigger[aria-expanded="true"] svg {
      transform: rotate(45deg);
      transition: transform 0.16s ease;
    }
    .nx-paper-continue-zone {
      flex: 1;
      min-width: 0;
      padding: 6px 2px;
      font-size: 13px;
      color: var(--nx-fg-faint, var(--text-faint));
      opacity: 0.52;
      cursor: text;
      user-select: none;
      transition: opacity 0.15s ease, color 0.15s ease;
    }
    .nx-paper-continue-zone:hover {
      opacity: 0.88;
      color: var(--nx-fg-muted, var(--text-muted));
    }
    .nx-paper-continue-zone kbd {
      display: inline-block;
      padding: 0 5px;
      border-radius: 5px;
      font-family: 'JetBrains Mono', ui-monospace, monospace;
      font-size: 11px;
      border: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-elev, var(--bg-subtle));
    }
    .nx-insert-popover {
      position: fixed;
      left: 12px;
      top: 72px;
      width: 368px;
      max-width: calc(100vw - 24px);
      max-height: min(380px, calc(100dvh - 96px));
      overflow-y: auto;
      overscroll-behavior: contain;
      padding: 11px;
      border-radius: 16px;
      background: var(--nx-surface, #171715);
      border: 1px solid var(--nx-border-strong, rgba(243, 240, 232, 0.2));
      box-shadow: 0 22px 60px rgba(0, 0, 0, 0.54);
      z-index: 75;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .nx-insert-popover.hidden {
      display: none !important;
    }
    .nx-slash-ac-chip {
      display: inline-flex;
      align-items: center;
      gap: 0;
      padding: 2px 7px;
      border-radius: 7px;
      border: 1px solid var(--nx-border-strong, rgba(243, 240, 232, 0.18));
      background: var(--nx-elev, rgba(255, 255, 255, 0.05));
      font-family: 'JetBrains Mono', ui-monospace, monospace;
      font-size: 11px;
      line-height: 1.35;
      color: var(--nx-fg, var(--text-strong));
      cursor: pointer;
      max-width: 190px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .nx-slash-ac-chip:hover {
      border-color: var(--nx-accent, #C8935A);
    }
    .nx-slash-ghost {
      opacity: 0.45;
      font-weight: 400;
    }
    .nx-slash-kbd {
      margin-left: 6px;
      padding: 0 4px;
      border-radius: 4px;
      font-size: 9.5px;
      font-weight: 600;
      border: 1px solid var(--nx-border, var(--border-subtle));
      color: var(--nx-fg-muted, var(--text-muted));
      background: transparent;
    }
    .nx-slash-match {
      color: var(--nx-accent, #C8935A);
      font-weight: 600;
    }
    .nx-insert-meta {
      min-width: 0;
      flex: 1 1 0%;
    }
    .nx-insert-meta small {
      font-family: 'JetBrains Mono', ui-monospace, monospace;
      font-size: 10px;
    }
    .nx-insert-pop-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 2px 6px 2px;
      border-bottom: 1px solid var(--nx-border, var(--border-subtle));
      font-size: 11.5px;
      font-weight: 600;
      letter-spacing: 0.01em;
      color: var(--nx-fg-muted, var(--text-muted));
    }
    .nx-insert-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px;
    }
    .nx-insert-card {
      display: flex;
      align-items: center;
      gap: 9px;
      padding: 8px 9px;
      min-height: 44px;
      border-radius: 12px;
      border: 1px solid transparent;
      background: transparent;
      text-align: left;
      cursor: pointer;
      transition: background-color 0.13s ease, border-color 0.13s ease;
    }
    .nx-insert-card:hover,
    .nx-insert-card.is-slash-active {
      background: var(--nx-elev, var(--bg-subtle));
      border-color: var(--nx-border-strong, var(--border-subtle));
    }
    .nx-insert-card.is-slash-active {
      box-shadow: inset 0 0 0 1px var(--nx-accent, #C8935A);
    }
    #ins-tab-widgets,
    #ins-tab-workspace {
      height: auto;
      min-height: 38px;
      padding: 6px 10px;
      line-height: 1.25;
      text-align: center;
    }
    .nx-element-tile {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 11px;
      min-height: 56px;
      border-radius: 14px;
      border: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-elev, var(--bg-subtle));
      text-align: left;
      cursor: pointer;
      transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
    }
    .nx-element-tile > span:last-child {
      flex: 1 1 0%;
      min-width: 0;
    }
    .nx-element-tile:hover {
      background: var(--nx-elev-hover, var(--bg-subtle-hover));
      border-color: var(--nx-accent, #C8935A);
      transform: translateY(-1px);
    }
    .nx-element-tile strong {
      display: block;
      font-size: 12px;
      font-weight: 600;
      line-height: 1.25;
      color: var(--nx-fg, var(--text-strong));
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .nx-element-tile small {
      display: block;
      font-size: 10.5px;
      font-weight: 400;
      line-height: 1.3;
      margin-top: 2px;
      color: var(--nx-fg-muted, var(--text-muted));
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .nx-insert-icon {
      width: 30px;
      height: 30px;
      border-radius: 9px;
      background: var(--nx-elev, var(--bg-subtle));
      border: 1px solid var(--nx-border, var(--border-subtle));
      color: var(--nx-fg, var(--text-strong));
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .nx-insert-card strong {
      display: block;
      font-size: 12px;
      font-weight: 600;
      line-height: 1.2;
      color: var(--nx-fg, var(--text-strong));
    }
    .nx-insert-card small {
      display: block;
      font-size: 10.5px;
      font-weight: 400;
      line-height: 1.2;
      margin-top: 2px;
      color: var(--nx-fg-muted, var(--text-muted));
    }
    @media (max-width: 767px) {
      .nx-plus-trigger {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
      }
      .nx-insert-popover {
        border-radius: 18px;
        z-index: 75;
      }
    }

    /* Editorial Notifications Center — Flagship Android One UI & Carbon/Paper Protocol */
    .nx-notif-desktop-heading {
      display: none;
    }
    .nx-notif-mobile-back {
      display: inline-flex;
    }
    .nx-notif-desktop-strip {
      display: none;
    }
    .nx-notif-mobile-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      width: 100%;
      min-width: 0;
    }
    .nx-notif-filter-drawer.hidden {
      display: none !important;
    }
    @media (min-width: 640px) {
      .nx-notif-desktop-heading {
        display: flex;
      }
      .nx-notif-mobile-back {
        display: none !important;
      }
      .nx-notif-desktop-strip {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 3px;
        flex: 1 1 0%;
        min-width: 0;
      }
      .nx-notif-mobile-bar {
        display: none !important;
      }
      .nx-notif-filter-drawer,
      .nx-notif-filter-drawer.hidden {
        display: flex !important;
        width: auto !important;
        padding-top: 0 !important;
        border-top: 0 !important;
      }
      .nx-notif-mobile-select {
        display: none !important;
      }
    }
    .nx-notif-desktop-action {
      display: none;
    }
    @media (min-width: 768px) {
      .nx-notif-desktop-action {
        display: inline-flex;
        align-items: center;
      }
    }
    .nx-notif-detail-desktop {
      display: none;
    }
    @media (min-width: 1024px) {
      .nx-notif-detail-desktop {
        display: block;
      }
      .nx-notif-mobile-actions {
        display: none !important;
      }
      .nx-notif-quick-btn {
        display: none !important;
      }
    }
    .nx-notif-detail-desktop.hidden {
      display: none !important;
    }
    .nx-notif-filter-tab {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      min-height: 32px;
      padding: 0 10px;
      border-radius: 9999px;
      border: 1px solid transparent;
      background: transparent;
      color: var(--nx-fg-muted, var(--text-muted));
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
      cursor: pointer;
      transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
    }
    .nx-notif-filter-tab:hover {
      background: color-mix(in srgb, var(--nx-fg) 6%, transparent);
      color: var(--nx-fg, var(--text-strong));
    }
    .nx-notif-filter-tab.is-active {
      background: var(--nx-primary-bg, #ECEAE4);
      border-color: transparent;
      color: var(--nx-primary-fg, #0E0E0D);
      font-weight: 600;
    }
    html[data-theme="light"] .nx-notif-filter-tab.is-active {
      background: #141413;
      color: #F7F6F2;
    }
    .nx-notif-unread-chip {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      height: 22px;
      padding: 0 9px;
      border-radius: 9999px;
      font-size: 11px;
      font-weight: 600;
      background: color-mix(in srgb, var(--nx-accent, #C8935A) 18%, transparent);
      border: 1px solid color-mix(in srgb, var(--nx-accent, #C8935A) 34%, transparent);
      color: var(--nx-fg, var(--text-strong));
    }
    .nx-notif-unread-chip.hidden {
      display: none !important;
    }
    .nx-notif-unread-dot {
      width: 7px;
      height: 7px;
      border-radius: 9999px;
      background: var(--nx-accent, #C8935A);
      flex-shrink: 0;
    }
    /* Tactile Android One UI / Apple HIG Pill Switch (replaces raw square checkboxes) */
    .nx-notif-checkbox {
      -webkit-appearance: none;
      appearance: none;
      position: relative;
      width: 42px;
      height: 24px;
      border-radius: 9999px;
      background: rgba(255, 255, 255, 0.14);
      border: 1px solid rgba(255, 255, 255, 0.16);
      cursor: pointer;
      flex-shrink: 0;
      transition: background-color 0.18s ease, border-color 0.18s ease;
    }
    html[data-theme="light"] .nx-notif-checkbox {
      background: rgba(20, 20, 19, 0.14);
      border-color: rgba(20, 20, 19, 0.16);
    }
    .nx-notif-checkbox::after {
      content: "";
      position: absolute;
      top: 2px;
      left: 2px;
      width: 18px;
      height: 18px;
      border-radius: 9999px;
      background: #B8B4AB;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
      transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.18s ease;
    }
    html[data-theme="light"] .nx-notif-checkbox::after {
      background: #FFFFFF;
    }
    .nx-notif-checkbox:checked {
      background: var(--nx-accent, #C8935A);
      border-color: var(--nx-accent, #C8935A);
    }
    .nx-notif-checkbox:checked::after {
      transform: translateX(18px);
      background: #0E0E0D;
    }
    html[data-theme="light"] .nx-notif-checkbox:checked {
      background: #141413;
      border-color: #141413;
    }
    html[data-theme="light"] .nx-notif-checkbox:checked::after {
      background: #F7F6F2;
    }
    .nx-notif-actions-popover {
      position: absolute;
      right: 0;
      top: calc(100% + 6px);
      width: 204px;
      padding: 6px;
      border-radius: 14px;
      background: var(--nx-bg-elevated, #161614);
      border: 1px solid var(--nx-border-strong, rgba(255, 255, 255, 0.14));
      box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.48);
      z-index: 45;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    html[data-theme="light"] .nx-notif-actions-popover {
      background: #FFFFFF;
      border-color: rgba(20, 20, 19, 0.12);
      box-shadow: 0 18px 40px -12px rgba(20, 20, 19, 0.16);
    }
    .nx-notif-actions-popover.hidden {
      display: none !important;
    }
    .nx-notif-action-item {
      display: flex;
      align-items: center;
      gap: 8px;
      width: 100%;
      min-height: 38px;
      padding: 7px 10px;
      border-radius: 9px;
      font-size: 12.5px;
      font-weight: 500;
      color: var(--nx-fg, var(--text-strong));
      background: transparent;
      text-align: left;
      transition: background-color 0.12s ease;
    }
    .nx-notif-action-item:hover {
      background: color-mix(in srgb, var(--nx-fg) 7%, transparent);
    }
    .nx-notif-row {
      position: relative;
      padding: 14px 16px;
      cursor: pointer;
      transition: background-color 0.14s ease;
    }
    .nx-notif-row.is-unread {
      background: color-mix(in srgb, var(--nx-accent, #C8935A) 4.5%, transparent);
    }
    .nx-notif-row.is-unread::before {
      content: "";
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 3px;
      background: var(--nx-accent, #C8935A);
    }
    .nx-notif-row:hover {
      background: color-mix(in srgb, var(--nx-fg) 4%, transparent);
    }
    .nx-notif-row.is-selected {
      background: color-mix(in srgb, var(--nx-fg) 6%, transparent);
    }
    @media (max-width: 1023px) {
      .nx-notif-row.is-selected:not(.is-mob-expanded) {
        background: transparent;
      }
      .nx-notif-row.is-unread.is-selected:not(.is-mob-expanded) {
        background: color-mix(in srgb, var(--nx-accent, #C8935A) 4.5%, transparent);
      }
    }
    @media (max-width: 767px) {
      #mode-notifications input:not([type="checkbox"]),
      #mode-notifications select,
      #notif-center-root input:not([type="checkbox"]),
      #notif-center-root select {
        font-size: 16px !important;
      }
      .nx-notif-row {
        padding: 13px 14px;
      }
    }
    @media (max-width: 380px) {
      .nx-notif-filter-tab {
        padding: 0 8px;
        font-size: 11px;
      }
    }

    /* Lucid-Grade Visual Flowchart & Open-Source Diagram Studio */
    .nx-fc-studio-shell {
      width: 100%;
      max-width: 1220px;
      height: min(92dvh, 860px);
      max-height: 92dvh;
      background: var(--nx-surface, #171715);
      border: 1px solid var(--nx-border-strong, rgba(243, 240, 232, 0.16));
    }
    .nx-fc-topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 9px 12px;
      border-bottom: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-elev, rgba(255, 255, 255, 0.02));
      flex-shrink: 0;
    }
    .nx-fc-brand-icon {
      width: 28px;
      height: 28px;
      border-radius: 8px;
      border: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-surface, #171715);
      color: var(--nx-accent, #C8935A);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .nx-fc-title-input {
      background: transparent;
      border: 1px solid transparent;
      border-radius: 8px;
      padding: 4px 8px;
      font-size: 13px;
      font-weight: 600;
      color: var(--nx-fg, var(--text-strong));
      min-width: 110px;
      max-width: 240px;
      width: 100%;
    }
    .nx-fc-title-input:hover,
    .nx-fc-title-input:focus {
      outline: none;
      border-color: var(--nx-border-strong, rgba(243, 240, 232, 0.2));
      background: var(--nx-surface, #171715);
    }
    .nx-fc-tool-group {
      display: flex;
      align-items: center;
      gap: 4px;
      flex-wrap: nowrap;
      overflow-x: auto;
      scrollbar-width: none;
    }
    .nx-fc-tool-group::-webkit-scrollbar { display: none; }
    .nx-fc-tool-btn,
    .nx-fc-icon-btn {
      height: 30px;
      border-radius: 8px;
      border: 1px solid transparent;
      background: transparent;
      color: var(--nx-fg-muted, var(--text-muted));
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      font-size: 11.5px;
      font-weight: 500;
      cursor: pointer;
      transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    }
    .nx-fc-tool-btn { padding: 0 9px; }
    .nx-fc-icon-btn { width: 30px; padding: 0; }
    .nx-fc-tool-btn:hover,
    .nx-fc-icon-btn:hover {
      background: var(--nx-elev-hover, rgba(255, 255, 255, 0.06));
      color: var(--nx-fg, var(--text-strong));
    }
    .nx-fc-tool-btn.is-active {
      background: color-mix(in srgb, var(--nx-accent, #C8935A) 16%, transparent);
      border-color: color-mix(in srgb, var(--nx-accent, #C8935A) 45%, transparent);
      color: var(--nx-fg, var(--text-strong));
    }
    .nx-fc-divider {
      width: 1px;
      height: 18px;
      background: var(--nx-border, var(--border-subtle));
      margin: 0 2px;
      flex-shrink: 0;
    }
    .nx-fc-select {
      height: 30px;
      padding: 0 8px;
      border-radius: 8px;
      border: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-surface, #171715);
      color: var(--nx-fg, var(--text-strong));
      font-size: 11.5px;
      max-width: 148px;
    }
    .nx-fc-workspace {
      display: grid;
      grid-template-columns: 224px minmax(0, 1fr) 232px;
      flex: 1 1 0%;
      min-height: 0;
      overflow: hidden;
    }
    .nx-fc-left-rail {
      border-right: 1px solid var(--nx-border, var(--border-subtle));
      display: flex;
      flex-direction: column;
      min-height: 0;
      background: var(--nx-elev, rgba(255, 255, 255, 0.015));
    }
    .nx-fc-rail-search {
      padding: 8px;
      border-bottom: 1px solid var(--nx-border, var(--border-subtle));
    }
    .nx-fc-search-input {
      width: 100%;
      height: 30px;
      padding: 0 9px;
      border-radius: 8px;
      border: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-surface, #171715);
      color: var(--nx-fg, var(--text-strong));
      font-size: 11.5px;
    }
    .nx-fc-shape-groups {
      flex: 1 1 0%;
      overflow-y: auto;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .nx-fc-cat-title {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--nx-fg-muted, var(--text-muted));
      margin-bottom: 6px;
      padding: 0 2px;
    }
    .nx-fc-shape-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 5px;
    }
    .nx-fc-shape-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      padding: 7px 4px;
      border-radius: 10px;
      border: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-surface, #171715);
      color: var(--nx-fg, var(--text-strong));
      cursor: grab;
      transition: border-color 0.12s ease, transform 0.1s ease, background-color 0.12s ease;
    }
    .nx-fc-shape-btn:hover {
      border-color: var(--nx-accent, #C8935A);
      background: var(--nx-elev-hover, rgba(255, 255, 255, 0.05));
      transform: translateY(-1px);
    }
    .nx-fc-shape-ico {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      height: 22px;
    }
    .nx-fc-shape-lbl {
      font-size: 10px;
      font-weight: 500;
      line-height: 1.15;
      text-align: center;
      color: var(--nx-fg-muted, var(--text-muted));
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .nx-fc-canvas-stage {
      position: relative;
      overflow: hidden;
      min-width: 0;
      min-height: 0;
    }
    .nx-fc-canvas {
      display: block;
      width: 100%;
      height: 100%;
      touch-action: none;
    }
    .nx-fc-empty-hint {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
      padding: 16px;
    }
    .nx-fc-empty-hint.hidden { display: none !important; }
    .nx-fc-empty-card {
      pointer-events: auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      text-align: center;
      padding: 18px 20px;
      border-radius: 16px;
      border: 1px dashed var(--nx-border-strong, rgba(243, 240, 232, 0.2));
      background: color-mix(in srgb, var(--nx-surface, #171715) 88%, transparent);
      backdrop-filter: blur(8px);
    }
    .nx-fc-quick-chip {
      padding: 5px 10px;
      border-radius: 8px;
      border: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-elev, rgba(255, 255, 255, 0.05));
      color: var(--nx-fg, var(--text-strong));
      font-size: 11px;
      font-weight: 500;
      cursor: pointer;
    }
    .nx-fc-quick-chip:hover {
      border-color: var(--nx-accent, #C8935A);
    }
    .nx-fc-inline-editor {
      position: absolute;
      z-index: 12;
      height: 32px;
      padding: 0 10px;
      border-radius: 8px;
      border: 1.5px solid var(--nx-accent, #C8935A);
      background: var(--nx-surface, #171715);
      color: var(--nx-fg, var(--text-strong));
      font-size: 12px;
      font-weight: 600;
      text-align: center;
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
      outline: none;
    }
    .nx-fc-zoom-bar {
      position: absolute;
      right: 12px;
      bottom: 12px;
      display: inline-flex;
      align-items: center;
      gap: 2px;
      padding: 3px;
      border-radius: 10px;
      border: 1px solid var(--nx-border, var(--border-subtle));
      background: color-mix(in srgb, var(--nx-surface, #171715) 92%, transparent);
      backdrop-filter: blur(8px);
      z-index: 8;
    }
    .nx-fc-zoom-btn {
      min-width: 26px;
      height: 26px;
      border-radius: 7px;
      border: 0;
      background: transparent;
      color: var(--nx-fg, var(--text-strong));
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }
    .nx-fc-zoom-btn:hover { background: var(--nx-elev-hover, rgba(255, 255, 255, 0.08)); }
    .nx-fc-zoom-label {
      min-width: 40px;
      text-align: center;
      font-family: 'JetBrains Mono', ui-monospace, monospace;
      font-size: 10.5px;
      color: var(--nx-fg-muted, var(--text-muted));
    }
    .nx-fc-mermaid-drawer {
      position: absolute;
      left: 10px;
      right: 10px;
      bottom: 48px;
      border-radius: 12px;
      border: 1px solid var(--nx-border-strong, rgba(243, 240, 232, 0.2));
      background: var(--nx-surface, #171715);
      box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
      overflow: hidden;
      z-index: 10;
    }
    .nx-fc-right-rail {
      border-left: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-elev, rgba(255, 255, 255, 0.015));
      overflow-y: auto;
      min-height: 0;
    }
    .nx-fc-inspector-body {
      padding: 11px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .nx-fc-insp-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--nx-fg-muted, var(--text-muted));
      padding-bottom: 6px;
      border-bottom: 1px solid var(--nx-border, var(--border-subtle));
    }
    .nx-fc-danger-btn {
      font-size: 10.5px;
      font-weight: 600;
      color: #F43F5E;
      text-transform: none;
      letter-spacing: 0;
      padding: 2px 6px;
      border-radius: 6px;
      background: rgba(244, 63, 94, 0.12);
      cursor: pointer;
    }
    .nx-fc-field {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .nx-fc-field > span {
      font-size: 10.5px;
      font-weight: 600;
      color: var(--nx-fg-muted, var(--text-muted));
    }
    .nx-fc-input {
      width: 100%;
      height: 30px;
      padding: 0 8px;
      border-radius: 8px;
      border: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-surface, #171715);
      color: var(--nx-fg, var(--text-strong));
      font-size: 11.5px;
    }
    .nx-fc-swatch-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    .nx-fc-swatch {
      width: 20px;
      height: 20px;
      border-radius: 9999px;
      border: 2px solid transparent;
      cursor: pointer;
    }
    .nx-fc-swatch.is-active {
      border-color: var(--nx-fg, #FFFFFF);
      transform: scale(1.1);
    }
    .nx-fc-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 9px 12px;
      border-top: 1px solid var(--nx-border, var(--border-subtle));
      background: var(--nx-elev, rgba(255, 255, 255, 0.02));
      flex-shrink: 0;
    }
    @media (max-width: 900px) {
      .nx-fc-studio-shell {
        height: 94dvh;
        max-height: 94dvh;
      }
      .nx-fc-topbar {
        padding: 7px 9px;
        gap: 6px;
        flex-wrap: wrap;
      }
      .nx-fc-tool-group {
        order: 3;
        flex-basis: 100%;
        padding-top: 4px;
        border-top: 1px solid var(--nx-border, var(--border-subtle));
      }
      .nx-fc-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
      }
      .nx-fc-left-rail {
        border-right: 0;
        border-bottom: 1px solid var(--nx-border, var(--border-subtle));
        max-height: 98px;
      }
      .nx-fc-rail-search { display: none; }
      .nx-fc-shape-groups {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 6px 8px;
        gap: 10px;
      }
      .nx-fc-cat-group {
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
      }
      .nx-fc-shape-grid {
        display: flex;
        gap: 5px;
      }
      .nx-fc-shape-btn {
        width: 72px;
        flex-shrink: 0;
      }
      .nx-fc-right-rail {
        border-left: 0;
        border-top: 1px solid var(--nx-border, var(--border-subtle));
        max-height: 152px;
      }
    }

    ::-webkit-scrollbar { width: 6px; height: 6px; }
    ::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.25); border-radius: 9999px; }
