  /* =========================================
     ONLINE NOTEPAD — PREMIUM UI
     ========================================= */
  .da-wrapper {
      --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
      --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
      display: flex;
      justify-content: center;
          padding: clamp(0px, 5vw, 0px) 20px;
  }

  .da-panel {
      position: relative;                
      width: 100%;
      max-width: 1300px;
      border-radius: 28px;
      padding: clamp(28px, 5vw, 56px);
  }

  /* ---------- APP PORTAL ---------- */
  .fs-btn-wrap { display: flex; justify-content: flex-end; margin-bottom: 16px; }
  .fs-btn { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 8px 16px; font-size: 12px; font-weight: 800; color: var(--text-main); display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 12px rgba(0,0,0,0.02); }
  .fs-btn:hover { border-color: var(--primary-color); color: var(--primary-color); transform: translateY(-1px); }

  .app-slot { position: relative; width: 100%; min-height: 700px; }
  
  .app-portal { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 20px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.03); display: flex; flex-direction: column; width: 100%; height: 700px; position: relative; transition: all 0.3s; }
  
  /* Fullscreen Mode */
  .app-portal.fullscreen-portal { position: fixed; inset: 0; width: 100vw; height: 100vh; border-radius: 0; border: none; z-index: 9999; }

  /* ---------- PIN SCREEN ---------- */
  .pin-screen { position: absolute; inset: 0; background: var(--bg-body); z-index: 50; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
  .pin-screen.show { opacity: 1; pointer-events: auto; }
  .pin-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 20px; padding: 40px; text-align: center; max-width: 400px; width: 90%; box-shadow: 0 20px 50px rgba(0,0,0,0.05); }
  .pin-icon { width: 56px; height: 56px; border-radius: 16px; background: rgba(var(--primary-color-rgb), 0.1); color: var(--primary-color); display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
  .pin-card h2 { font-size: 20px; font-weight: 800; color: var(--text-main); margin-bottom: 8px; }
  .pin-card p { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; }
  
  .pin-inputs { display: flex; justify-content: center; gap: 12px; margin-bottom: 16px; }
  .pin-digit { width: 48px; height: 56px; background: var(--bg-body); border: 1px solid var(--border-color); border-radius: 12px; font-size: 24px; font-weight: 800; text-align: center; color: var(--text-main); outline: none; transition: border-color 0.2s; }
  .pin-digit:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1); }
  .pin-error { color: #ef4444; font-size: 12px; font-weight: 700; min-height: 18px; margin-bottom: 20px; }

  /* ---------- MAIN APP ---------- */
  .main-app { display: flex; flex-direction: column; width: 100%; height: 100%; flex: 1; overflow: hidden; position: relative; }
  
  .topbar { display: flex; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border-color); background: var(--bg-body); flex-shrink: 0; gap: 16px; flex-wrap: wrap; }
  .tb-logo { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 900; color: var(--text-main); }
  .tb-gem { width: 28px; height: 28px; background: linear-gradient(135deg, var(--primary-color), var(--primary-gradient-end)); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; }
  .tb-logo em { color: var(--primary-color); font-style: normal; }
  .tb-sep { width: 1px; height: 24px; background: var(--border-color); }
  
  .note-title-input { flex: 1; min-width: 150px; background: transparent; border: none; font-size: 16px; font-weight: 700; color: var(--text-main); outline: none; }
  .note-title-input::placeholder { color: var(--text-muted); opacity: 0.5; }
  
  .tb-actions { display: flex; align-items: center; gap: 12px; }
  
  .status-badge { font-family: 'Space Mono', monospace; font-size: 10px; font-weight: 800; padding: 4px 8px; border-radius: 6px; text-transform: uppercase; }
  .status-badge.local { background: rgba(59, 130, 246, 0.1); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.2); }
  .status-badge.shared { background: rgba(34, 197, 94, 0.1); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.2); }
  /* ---------- CUSTOM DROPDOWN ---------- */
  .custom-dropdown { position: relative; display: inline-block; user-select: none; }
  .cd-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card-bg); border: 1px solid var(--border-color); padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 800; color: var(--text-main); cursor: pointer; transition: all 0.2s; min-width: 130px; }
  .cd-header:hover, .custom-dropdown.active .cd-header { border-color: var(--primary-color); color: var(--primary-color); background: var(--primary-light); }
  .cd-value { display: flex; align-items: center; gap: 8px; }
  .cd-body { position: absolute; top: calc(100% + 8px); right: 0; width: 220px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); padding: 8px; z-index: 100; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s; display: flex; flex-direction: column; gap: 8px; }
  .custom-dropdown.active .cd-body { opacity: 1; visibility: visible; transform: translateY(0); }
  .cd-search input { width: 100%; background: var(--bg-body); border: 1px solid var(--border-color); border-radius: 8px; padding: 8px 12px; font-size: 12px; color: var(--text-main); outline: none; }
  .cd-list { max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
  .cd-list::-webkit-scrollbar { width: 4px; }
  .cd-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
  .cd-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--text-main); cursor: pointer; transition: background 0.2s; }
  .cd-item:hover { background: var(--bg-body); }
  .cd-item.active { background: rgba(var(--primary-color-rgb), 0.05); color: var(--primary-color); }
  
  .tb-btn { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 800; color: var(--text-main); display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
  .tb-btn:hover { border-color: var(--primary-color); }
  .tb-btn.primary { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
  .tb-btn.primary:hover { opacity: 0.9; }
  .tb-btn.danger { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.05); }

  /* ---------- APP BODY (Sidebar + Main) ---------- */
  .app-body { display: flex; flex: 1; min-height: 0; position: relative; }
  
  .sidebar { width: 280px; background: var(--bg-body); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; flex-shrink: 0; transition: transform 0.3s; }
  .sb-header { padding: 16px; border-bottom: 1px solid var(--border-color); display: flex; gap: 12px; }
  .sb-search-wrap { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 0 12px; height: 36px; }
  .sb-search-wrap input { flex: 1; background: transparent; border: none; font-size: 13px; color: var(--text-main); outline: none; min-width: 0; }
  .new-btn { width: 36px; height: 36px; background: var(--primary-color); color: #fff; border: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: opacity 0.2s; flex-shrink: 0; }
  .new-btn:hover { opacity: 0.9; }
  
  .note-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
  .note-item { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 12px; cursor: pointer; transition: all 0.2s; position: relative; display: flex; flex-direction: column; gap: 6px; }
  .note-item:hover { border-color: var(--primary-color); }
  .note-item.active { border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.1); }
  .ni-title { font-size: 13px; font-weight: 800; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 20px; }
  .ni-preview { font-size: 12px; color: var(--text-muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: 0.8; }
  .ni-meta { display: flex; justify-content: space-between; align-items: center; font-size: 10px; font-weight: 700; color: var(--text-muted); font-family: 'Space Mono', monospace; margin-top: 4px; }
  .ni-tags { display: flex; gap: 4px; }
  .ni-tag { padding: 2px 6px; border-radius: 4px; background: var(--bg-body); border: 1px solid var(--border-color); }
  .ni-tag.shared { color: #22c55e; border-color: rgba(34, 197, 94, 0.2); }
  .ni-tag.md { color: #a855f7; border-color: rgba(168, 85, 247, 0.2); }
  
  .ni-del { position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); background: var(--bg-body); border: 1px solid var(--border-color); opacity: 0; transition: all 0.2s; }
  .note-item:hover .ni-del { opacity: 1; }
  .ni-del:hover { color: #ef4444; border-color: #ef4444; background: rgba(239, 68, 68, 0.1); }
  
  .sb-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); font-size: 13px; font-weight: 600; text-align: center; gap: 12px; opacity: 0.6; }

  @media(max-width: 768px) {
      .sidebar { position: absolute; top: 0; left: 0; height: 100%; z-index: 20; transform: translateX(-100%); box-shadow: 10px 0 30px rgba(0,0,0,0.1); }
      .sidebar.open { transform: translateX(0); }
      .mob-sb-btn { display: inline-flex !important; }
  }

  /* ---------- EDITOR AREA ---------- */
  .editor-area { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--card-bg); }
  
  .editor-toolbar { padding: 12px 20px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 16px; overflow-x: auto; flex-shrink: 0; }
  .et-group { display: flex; gap: 4px; }
  .et-btn { width: 30px; height: 30px; border-radius: 6px; background: transparent; border: 1px solid transparent; color: var(--text-main); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; flex-shrink: 0; }
  .et-btn:hover { background: var(--bg-body); border-color: var(--border-color); color: var(--primary-color); }
  
  .et-sep { width: 1px; height: 20px; background: var(--border-color); flex-shrink: 0; }
  
  .wc-strip { display: flex; gap: 12px; font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700; color: var(--text-muted); }
  .wc-item { display: flex; align-items: center; gap: 6px; }
  
  .md-toggle-wrap { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  .md-label { font-size: 11px; font-weight: 800; color: var(--text-muted); }
  .sw-sm { width: 32px; height: 18px; background: var(--bg-body); border: 1px solid var(--border-color); border-radius: 100px; position: relative; cursor: pointer; transition: background 0.3s; }
  .sw-sm.on { background: var(--primary-color); border-color: var(--primary-color); }
  .sw-sm-thumb { width: 12px; height: 12px; background: #fff; border-radius: 50%; position: absolute; top: 2px; left: 2px; transition: transform 0.3s var(--ease-spring); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
  .sw-sm.on .sw-sm-thumb { transform: translateX(14px); }
  
  .view-toggle { display: flex; background: var(--bg-body); border: 1px solid var(--border-color); border-radius: 6px; padding: 2px; }
  .vt-btn { background: transparent; border: none; padding: 4px 10px; font-size: 11px; font-weight: 800; color: var(--text-muted); border-radius: 4px; cursor: pointer; transition: all 0.2s; }
  .vt-btn.active { background: var(--card-bg); color: var(--primary-color); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

  .editor-body { flex: 1; display: flex; min-height: 0; position: relative; }
  .main-editor { flex: 1; width: 100%; height: 100%; border: none; background: transparent; padding: 24px; font-size: 15px; line-height: 1.7; color: var(--text-main); outline: none; resize: none; overflow-y: auto; }
  
  .md-preview { flex: 1; width: 100%; height: 100%; padding: 24px; overflow-y: auto; background: var(--bg-body); border-left: 1px solid var(--border-color); display: none; font-size: 15px; line-height: 1.7; color: var(--text-main); }
  .md-preview.show { display: block; }
  
  .editor-body.split .main-editor { width: 50%; flex: none; }
  .editor-body.split .md-preview { width: 50%; flex: none; }
  .editor-body.preview-only .main-editor { display: none; }
  
  /* Markdown Styles inside Preview */
  .md-preview h1, .md-preview h2, .md-preview h3 { font-weight: 800; color: var(--text-main); margin-bottom: 16px; margin-top: 24px; }
  .md-preview p { margin-bottom: 16px; }
  .md-preview a { color: var(--primary-color); text-decoration: underline; }
  .md-preview blockquote { border-left: 4px solid var(--primary-color); padding-left: 16px; margin-left: 0; color: var(--text-muted); font-style: italic; }
  .md-preview[dir="rtl"] blockquote { border-left: none; border-right: 4px solid var(--primary-color); padding-left: 0; padding-right: 16px; }
  .md-preview code { background: rgba(var(--primary-color-rgb), 0.1); color: var(--primary-color); padding: 2px 6px; border-radius: 4px; font-family: 'Space Mono', monospace; font-size: 13px; }
  .md-preview pre { background: var(--card-bg); border: 1px solid var(--border-color); padding: 16px; border-radius: 12px; overflow-x: auto; margin-bottom: 16px; }
  .md-preview pre code { background: transparent; padding: 0; color: var(--text-main); }

  .editor-footer { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid var(--border-color); background: var(--bg-body); font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
  .ef-left { display: flex; align-items: center; gap: 8px; }
  .ef-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; transition: background 0.3s; }
  .ef-dot.saved { background: #22c55e; }

  /* ---------- MODALS ---------- */
  .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 99999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
  .modal-overlay.show { opacity: 1; pointer-events: auto; }
  .modal { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 20px; padding: 32px; width: 90%; max-width: 450px; box-shadow: 0 20px 60px rgba(0,0,0,0.1); transform: translateY(20px); transition: transform 0.3s var(--ease-spring); }
  .modal-overlay.show .modal { transform: translateY(0); }
  
  .modal-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
  .modal-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
  .modal-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
  .modal-icon.red { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
  .modal-title { font-size: 18px; font-weight: 800; color: var(--text-main); }
  .modal-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
  
  .m-info { background: rgba(var(--primary-color-rgb), 0.05); border: 1px solid rgba(var(--primary-color-rgb), 0.1); padding: 12px; border-radius: 12px; font-size: 12px; line-height: 1.5; color: var(--text-muted); margin-bottom: 24px; display: flex; gap: 12px; align-items: flex-start; }
  .m-field { margin-bottom: 20px; }
  .m-label { display: block; font-size: 12px; font-weight: 800; color: var(--text-main); margin-bottom: 8px; }
  .m-input { width: 100%; background: var(--bg-body); border: 1px solid var(--border-color); border-radius: 10px; padding: 12px 16px; font-size: 14px; color: var(--text-main); outline: none; transition: border-color 0.2s; }
  .m-input:focus { border-color: var(--primary-color); }
  
  .share-url-box { background: var(--bg-body); border: 1px dashed var(--border-color); padding: 16px; border-radius: 10px; font-family: 'Space Mono', monospace; font-size: 12px; color: var(--primary-color); word-break: break-all; cursor: pointer; text-align: center; margin-bottom: 24px; transition: background 0.2s; }
  .share-url-box:hover { background: rgba(var(--primary-color-rgb), 0.05); }
  
  .m-actions { display: flex; justify-content: flex-end; gap: 12px; }
  .m-btn { padding: 10px 20px; border-radius: 10px; font-size: 13px; font-weight: 800; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s; border: none; }
  .m-btn.cancel { background: transparent; color: var(--text-muted); }
  .m-btn.cancel:hover { background: var(--bg-body); color: var(--text-main); }
  .m-btn.confirm { background: var(--primary-color); color: #fff; box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.2); }
  .m-btn.confirm:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(var(--primary-color-rgb), 0.3); }

  /* ── Comparison Panel & Analytics ── */
  .comparison-panel {
      background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 24px;
      padding: 28px; margin-top: 32px; box-shadow: 0 10px 30px rgba(0,0,0,0.02); margin-bottom: 40px;
  }
  .cp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
  .cp-title { font-size: 16px; font-weight: 800; color: var(--text-main); display: flex; align-items: center; gap: 10px; }
  .cp-badge { font-size: 12px; font-weight: 800; padding: 6px 14px; border-radius: 100px; }
  .badge-high { background: color-mix(in srgb, var(--success, #10b981) 15%, transparent); color: var(--success, #10b981); border: 1px solid color-mix(in srgb, var(--success, #10b981) 30%, transparent); }

  .cp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
  .cp-card { background: var(--bg-body); border: 1px solid var(--border-color); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
  .cpc-header { display: flex; justify-content: space-between; align-items: center; }
  .cpc-title { font-size: 13.5px; font-weight: 800; color: var(--text-main); }
  .cpc-tag { font-size: 11.5px; font-weight: 800; padding: 4px 10px; border-radius: 6px; }
  .cpc-tag.success { background: color-mix(in srgb, var(--success, #10b981) 15%, transparent); color: var(--success, #10b981); }

  .cpc-body { display: flex; flex-direction: column; gap: 10px; }
  .cpc-stat-row { font-size: 13px; color: var(--text-muted); display: flex; justify-content: space-between; }
  .cpc-stat-row strong { color: var(--text-main); font-weight: 700; }
  .cpc-progress-bar { width: 100%; height: 8px; background: var(--border-color); border-radius: 100px; overflow: hidden; margin-top: 4px; }
  .cpc-progress-fill { height: 100%; background: var(--primary-color); border-radius: 100px; transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
  .cpc-progress-fill.bg-gradient { background: linear-gradient(90deg, var(--primary-color), var(--primary-gradient-end)); }

  /* Zero-Inline Enhancements */
  #bgCv { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
  .rw-hero-badge i { width: 14px; height: 14px; }
  .fs-btn i { width: 15px; height: 15px; }
  .pin-icon i { width: 28px; height: 28px; }
  .m-btn.w-full { width: 100%; justify-content: center; }
  .m-btn i { width: 16px; height: 16px; }
  .tb-gem i { width: 16px; height: 16px; }
  .tb-actions.ms-auto { margin-inline-start: auto; }
  .cd-value i, .cd-item i { width: 16px; height: 16px; color: var(--text-muted); }
  .cd-header i.cd-chevron { width: 14px; height: 14px; }
  .mob-sb-btn { display: none; }
  .tb-btn i { width: 13px; height: 13px; }
  .tb-btn.mob-sb-btn i { width: 14px; height: 14px; }
  .sb-search-wrap i { width: 13px; height: 13px; color: var(--text-muted); }
  .new-btn i { width: 16px; height: 16px; }
  .sb-empty i { width: 32px; height: 32px; }
  .ni-del i { width: 11px; height: 11px; }
  .et-btn i { width: 14px; height: 14px; }
  .wc-item i { width: 11px; height: 11px; }
  .ef-shared-id { color: rgba(148, 163, 184, 0.5); }
  .cp-title i { color: var(--primary-color); }
  .info-div-t { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--text-main); margin-bottom: 20px; margin-top: 40px; }
  .info-div-t i { width: 16px; height: 16px; color: var(--primary-color); }